Send email through a SMTP Server that requires authentication

Discussion in 'ASP .Net' started by Rodrigo, Aug 28, 2003.

  1. Rodrigo

    Rodrigo Guest

    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 = ""
    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
     
    Rodrigo, Aug 28, 2003
    #1
    1. Advertising

  2. Rodrigo

    Marina Guest

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

    "Rodrigo" <> wrote in message
    news:0acf01c36d5e$a837f9e0$...
    > 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 = ""
    > 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
     
    Marina, Aug 28, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. networm
    Replies:
    3
    Views:
    18,355
  2. online
    Replies:
    0
    Views:
    891
    online
    Sep 6, 2009
  3. networm
    Replies:
    2
    Views:
    130
    Thomas Kratz
    Aug 12, 2004
  4. Bob
    Replies:
    0
    Views:
    133
  5. ashish makani
    Replies:
    5
    Views:
    614
    Mark Lawrence
    Sep 20, 2012
Loading...

Share This Page