Sending Mail in ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitbhanage
    New Member
    • Apr 2007
    • 1

    Sending Mail in ASP.NET

    I try to send the mail using asp.net 2005
    The code I am using is

    Try
    Dim strTo As String = "to@yahoo.c om"
    Dim strFrom As String = "from@gmail.com "
    Dim strSubject As String = "Hi Chris"
    SmtpMail.Send(s trFrom, strTo, strSubject, "Boby: Hi how r u")
    Response.Write( "Email is send")
    Catch ex As Exception
    Response.Write( ex.Message.ToSt ring)
    End Try


    First time I am successful to send the mail but then I got the error like :

    The transport failed to connect to the server.
    Failure sending mail.
    The transport failed to connect to the server.
  • ruchikagupta
    New Member
    • Mar 2007
    • 16

    #2
    the same problem came with me while doing the same thing the problem was tht local host was not installed on my system do check whether the local host is installed on ur system or not

    Originally posted by amitbhanage
    I try to send the mail using asp.net 2005
    The code I am using is

    Try
    Dim strTo As String = "to@yahoo.c om"
    Dim strFrom As String = "from@gmail.com "
    Dim strSubject As String = "Hi Chris"
    SmtpMail.Send(s trFrom, strTo, strSubject, "Boby: Hi how r u")
    Response.Write( "Email is send")
    Catch ex As Exception
    Response.Write( ex.Message.ToSt ring)
    End Try


    First time I am successful to send the mail but then I got the error like :

    The transport failed to connect to the server.
    Failure sending mail.
    The transport failed to connect to the server.

    Comment

    • supunf
      New Member
      • Dec 2006
      • 6

      #3
      Hi,

      there is a property called smtp.Server. ( ican't remember exsaclty) there
      in that give the ip address of the mail server.

      then it should be ok

      Cheers

      Supun Fernando



      Originally posted by amitbhanage
      I try to send the mail using asp.net 2005
      The code I am using is

      Try
      Dim strTo As String = "to@yahoo.c om"
      Dim strFrom As String = "from@gmail.com "
      Dim strSubject As String = "Hi Chris"
      SmtpMail.Send(s trFrom, strTo, strSubject, "Boby: Hi how r u")
      Response.Write( "Email is send")
      Catch ex As Exception
      Response.Write( ex.Message.ToSt ring)
      End Try


      First time I am successful to send the mail but then I got the error like :

      The transport failed to connect to the server.
      Failure sending mail.
      The transport failed to connect to the server.

      Comment

      • daltwisney
        New Member
        • Apr 2007
        • 1

        #4
        Originally posted by supunf
        Hi,

        there is a property called smtp.Server. ( ican't remember exsaclty) there
        in that give the ip address of the mail server.

        then it should be ok

        Cheers

        Supun Fernando
        SmtpMail.SMTPSe rver is a read/write property that you can use to find out what the mail server is. It's fairly common to add a key that represents the SMTP server to web.config or app.config, but one can always set this property dynamically (eg, SmtpMail.SMTPSe rver = mail-relay.foo.com ) It may also help to PING the mail server or connect to port 25 of the mail server to ensure that it's reachable. When all else fails, check with the local admin. :-)

        -d.

        Comment

        Working...