System.Net.Mail Problem... [modified]
-
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
-
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
heck this out http://www.codeguru.com/csharp/.net/net\_asp/email/article.php/c12755
saeee
-
heck this out http://www.codeguru.com/csharp/.net/net\_asp/email/article.php/c12755
saeee