By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,469 Members | 1,259 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,469 IT Pros & Developers. It's quick & easy.

Send email through a SMTP Server that requires authentication

P: n/a
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 = "me@mydomain.com.br"
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
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


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

"Rodrigo" <do*********@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
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 = "me@mydomain.com.br"
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.