日期:2014-05-19  浏览次数:20415 次

发送邮件出问题了,请教!!!
Server   Error   in   '/MailApplication '   Application.
--------------------------------------------

与服务器的传输连接失败。  
Description:   An   unhandled   exception   occurred   during   the   execution   of   the   current   web   request.   Please   review   the   stack   trace   for   more   information   about   the   error   and   where   it   originated   in   the   code.  

Exception   Details:   System.Runtime.InteropServices.COMException:   与服务器的传输连接失败。  

    Private   Sub   SendMail(ByVal   strSender   As   String,   ByVal   strReciver   As   String,   ByVal   strSubject   As   String,   _
        ByVal   strContent   As   String,   ByVal   strSmtpServer   As   String,   ByVal   strUserName   As   String,   ByVal   strUserpwd   As   String)

                Dim   objMail   As   New   MailMessage
                objMail.From   =   strSender
                objMail.To   =   strReciver
                objMail.Bcc   =   strReciver
                objMail.Subject   =   strSubject
                objMail.Body   =   strContent
                objMail.BodyFormat   =   MailFormat.Html
                objMail.Priority   =   MailPriority.High
                SmtpMail.SmtpServer   =   strSmtpServer
                'Validate    
                objMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ",   "1 ")
                'Login   Name  
                objMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ",   strUserName)
                'Login   Password  
                objMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ",   strUserpwd)

                SmtpMail.Send(objMail)

        End   Sub

在网上找了好久,也没解决问题..这个发送邮件运行起来挺怪的..本来好好运行着的.说出事就出事了..都没去改动代码.无非是emal更改一下配置而已..知道的请赐教

------解决方案--------------------
我测试了不少邮箱,有的新注册的邮箱就通过不了服务器验证(邮件服务器)
所有发不出邮件,以前注册的邮箱就没有问题
你看看,你的问题是不是这样
------解决方案--------------------
恩,,我遇到的问题也是这样,,126 /163以前注册的邮箱没有问题,,现在注册的就发不出了
------解决方案--------------------
我这里有个例子可以用,你把sendusername、sendpassword 后的字符串改成你自己的Email名字跟密码,再改一下SmtpServer 就可以了

MailMessage mail = new MailMessage();
mail.To = "povo@163.com ";