首页 新闻 会员 周边 捐助

C#实现邮箱发送

0
悬赏园豆:5 [已关闭问题] 关闭于 2012-07-26 15:58
/”应用程序中的服务器错误。
由于目标计算机积极拒绝,无法连接。 192.168.1.188:25
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Net.Sockets.SocketException: 由于目标计算机积极拒绝,无法连接。 192.168.1.188:25

源错误:


行 147:
行 148:            client.Credentials = CredentialCache.DefaultNetworkCredentials;
行 149:            client.Send(message);
行 150:
行 151:        }


源文件: F:\mly框架\WebMLY\WebMLY\WebTest.aspx.cs    行: 149

堆栈跟踪:


[SocketException (0x274d): 由于目标计算机积极拒绝,无法连接。 192.168.1.188:25]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +251
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +279

[WebException: 无法连接到远程服务器]
   System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +6132064
   System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +314
   System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21

 

public void CreateTimeoutTestMessage(string server) 
{
string from = "505018049@qq.com";
string to = "1796519132@qq.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message
= new MailMessage(from, to, subject, body);
SmtpClient client
= new SmtpClient(server); client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Send(message);
}
小银光的主页 小银光 | 初学一级 | 园豆:25
提问于:2012-07-26 15:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册