发送邮件时出现问题 [英] Issue in Sending Mails

查看:96
本文介绍了发送邮件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在Windows Server 2003中托管了MVC4应用程序,这是我们的本地服务器...



除了邮件功能之外,整个功能正常运行...



我在本地机器上运行的Mails功能很好,我在MVC4中开发了我的项目。 。



但同样的事情(邮件功能)在我们的本地服务器上无效...



例外是这样的



System.Net.WebException:无法解析远程名称:System.Net上的'send.one.com' System.Net.PooledStream.Activate。(Object owningObject,Boolean async,Int32 timeout,GeneralAsyncDelegate asyncCallback).ServicePoint.GetConnection(PooledStream PooledStream,Object owner,Boolean async,IPAddress& address,Socket& abortSocket,Socket& abortSocket6,Int32 timeout) Syst的System.Net.PooledStream.Activate(Object owningObject,GeneralAsyncDelegate asyncCallback) System.Net上System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)的System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)上的em.Net.ConnectionPool.GetConnection(Object owningObject,GeneralAsyncDelegate asyncCallback,Int32 creationTimeout)。 System.Net.Mail.SmtpClient.Send上的Mail.SmtpClient.GetConnection()(MailMessage消息)



我在所有地方都搜索过这个问题出现此问题是因为无效的DNS服务器配置也在此服务器中我们没有静态IP。



但我对这个解决方案有疑问在我的本地机器上也没有静态IP然后它如何工作...



请让我知道在我的loacl发送邮件的问题的确切原因服务器。



我正在提供我们为发送邮件而编写的代码....



---代码背后



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






--- 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>







谢谢广告vance ...




Thanks in advance...

推荐答案

主机名问题

请检查
host name issue
please check that


这篇关于发送邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆