Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Net.Mail Problem... [modified]

System.Net.Mail Problem... [modified]

Scheduled Pinned Locked Moved C#
helpcsharpasp-netcomsysadmin
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jijo BP
    wrote on last edited by
    #1

    Hi friends, I am facing a PROBLEM WHILE I send mails with the SMTP class of System.Net.Mail. The code shows below. MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddress("from@domain.com"); mail.To.Add("to@domain.com"); //set the content mail.Subject = "This is an email"; mail.Body = "this is the body content of the email."; //send the message SmtpClient smtp = new SmtpClient("mysmtpserver.net"); //to authenticate we set the username and password properites on the SmtpClient smtp.Credentials = new System.Net.NetworkCredential("user@domain.com", "password"); smtp.Send(mail); I have a valid smtp server name, username and password. I configured it to outlook and working fine. And wen I test it using telnet port 25 then also its working. I upload the file to my hosting space. I have two hosting account with godaddy. The mailing script is working fine in one hosting account. That hosting account have SSL and dedicated IP address. But the mailing code is not working in the other hosting account. That hosting account is Windows hosting + ASP.NET 2.0 supported. The error I am getting is as shown as below. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.Co

    S 1 Reply Last reply
    0
    • J Jijo BP

      Hi friends, I am facing a PROBLEM WHILE I send mails with the SMTP class of System.Net.Mail. The code shows below. MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddress("from@domain.com"); mail.To.Add("to@domain.com"); //set the content mail.Subject = "This is an email"; mail.Body = "this is the body content of the email."; //send the message SmtpClient smtp = new SmtpClient("mysmtpserver.net"); //to authenticate we set the username and password properites on the SmtpClient smtp.Credentials = new System.Net.NetworkCredential("user@domain.com", "password"); smtp.Send(mail); I have a valid smtp server name, username and password. I configured it to outlook and working fine. And wen I test it using telnet port 25 then also its working. I upload the file to my hosting space. I have two hosting account with godaddy. The mailing script is working fine in one hosting account. That hosting account have SSL and dedicated IP address. But the mailing code is not working in the other hosting account. That hosting account is Windows hosting + ASP.NET 2.0 supported. The error I am getting is as shown as below. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.Co

      S Offline
      S Offline
      saeee
      wrote on last edited by
      #2

      heck this out http://www.codeguru.com/csharp/.net/net\_asp/email/article.php/c12755

      saeee

      J 1 Reply Last reply
      0
      • S saeee

        heck this out http://www.codeguru.com/csharp/.net/net\_asp/email/article.php/c12755

        saeee

        J Offline
        J Offline
        Jijo BP
        wrote on last edited by
        #3

        Thanks Saeee. But the code is working in one of my domain. Its not supporting in my new doamin. I mean new hosting account. I tried System.Web.Mail and System.Net.Mail. I am getting same error.

        JIJO BABY - Lets Play C#

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups