Send email through a SMTP Server that requires authentication

R

Rodrigo

I'm trying to send an email message using my SMTP server
that requires authentication. How can I do that? My code
is:
Dim email As System.Web.Mail.MailMessage = New
System.Web.Mail.MailMessage
email.From = "(e-mail address removed)"
email.To = txtemail.Text
email.Subject = "We have receveid your comments"
email.BodyFormat = System.Web.Mail.MailFormat.Html
email.Body ="<html>" & _
"<head>" & _
"<title>Untitled Document</title>" & _
"</head>" & _
"<body>" & _
"<p><font color=""#0066FF"" size=""2""
face=""Arial, Helvetica, sans-serif"">Hi,</font></p>" & _
"<p><font color=""#0066FF"" size=""2""
face=""Arial, Helvetica, sans-serif"">You are welcome! " &
_
"</font></p>" & _
"<p><font color=""#0066FF"" size=""2""
face=""Arial, Helvetica, sans-serif"">Thanks,</font></p>"
& _
"<p>&nbsp;</p>" & _
"<p><font color=""#0066FF"" size=""2""
face=""Arial, Helvetica, sans-serif"">Me.</font></p>" & _
"</body>" & _
"</html>"

System.Web.Mail.SmtpMail.SmtpServer
= "smtp.mydomain.com.br"

System.Web.Mail.SmtpMail.Send(email)

Response.Redirect("cad_ok.aspx")

And I receive this error message:

System.Runtime.InteropServices.COMException: The transport
failed to connect to the server.

Thanks in advance,
Rodrigo
 
M

Marina

The native .NET classes do not support authentication when sending messages.
You will have to find/buy a 3rd party component that does.
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top