Hi,
I have Hosted MVC4 Application in Windows Server 2003 which is our Local Server...
The Entire functionality is working fine except mails functionality...
The Mails functionality working fine in my local machine which i had developed my project in MVC4..
But the same thing(Mails functionality) is not working in our local Server...
The exception is like this
System.Net.WebException: The remote name could not be resolved: 'send.one.com' 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.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message)
I have searched everywhere regarding this issue everyone says this problem was occurring because of not valid DNS Server Configuration also in this server we don't have the static IP.
But i have a doubt regarding this solution that is in my local machine is also not have static IP then how it works ...
please let me know the what exact reason to getting issue with sending mails in my loacl server.
I am giving the code which we have written for sending mails....
--- Code behind
public string SendMail(string sTo, string sSub, string sBody, string sIsHtml) {
string sRetMsg = string.Empty;
System.Net.Mail.MailMessage mailObj = new System.Net.Mail.MailMessage(FrmAddrss, sTo, sSub, sBody);
if (sIsHtml.Equals("Y"))
mailObj.IsBodyHtml = true;
SmtpClient SMTPServer = new SmtpClient();
try {
SMTPServer.Send(mailObj);
}
catch (Exception Ex) {
return Ex.Message + "<br/>" + Ex.InnerException;
}
return sRetMsg;
}
--- Web.confing
<system.net>
<mailSettings>
<smtp from="test@pratasolutions.com">
<network host="testhostname" port="25" userName="test@pratasolutions.com" password="testpassword" />
</smtp>
</mailSettings>
</system.net>
Thanks in advance...