How to send an email with SmtpMail.SmtpServer using a server which requires authentication?

V

Volker Jobst

Hi,

The following code works fine as long as I don't use a smtp-server which
requires authentication:

Sub sendMail()
Dim sfrom As String = TextBox1.Text
Dim sto As String = TextBox2.Text
Dim ssubject As String = TextBox3.Text
Dim sbody As String = RichTextBox1.Text
Dim omail As New MailMessage
With omail
..From = sfrom
..To = sto
..Subject = ssubject
..Body = sbody
End With
SmtpMail.SmtpServer = ""
Try
SmtpMail.Send(omail)
MsgBox("Alles ok")
Catch ex As System.Web.HttpException
MsgBox(ex.ErrorCode & " - " & ex.ToString)
End Try
End Sub

But I don't know how to use a server which requires authentication. I don't
know how to send the username and the password.

Thanx a lot.

volker jobst
 
C

Chad Z. Hower aka Kudzu

Volker Jobst said:
But I don't know how to use a server which requires authentication. I don't
know how to send the username and the password.

The .net mail class does not support authentication.

Try Indy, its free and supports about a dozen forms of commonly used auth
schemes:
http://www.indyproject.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top