无法连接远程服务器 [英] Unable to connect the remote server

查看:123
本文介绍了无法连接远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从实时服务器发送电子邮件时遇到错误。





日期:5/29/2019 12:27:16 PM < br $>


System.Net.Mail.SmtpException

消息:发送邮件失败。

StackTrace:在System.Net .Mail.SmtpClient.Send(MailMessage消息)

at AliAndAssociates.ApplicationForms.CrossNoticeManagement.CrossNoticeForm.Message()

at AliAndAssociates.ApplicationForms.CrossNoticeManagement.CrossNoticeForm.UCMemoButtonToolBar_SaveEvent(Object发件人,EventArgs e)

System.Net.WebException

消息:无法连接到远程服务器

StackTrace:在System.Net上。 ServicePoint.GetConnection(PooledStream PooledStream,Object owner,Boolean async,IPAddress& address,Socket& abortSocket,Socket& abortSocket6)

at System.Net.PooledStream.Activate(Object owningObject,Boolean async,GeneralAsyncDelegate asyncCallback )System / Net.ConnectionPoo上的
l.GetConnection(Object owningObject,GeneralAsyncDelegate asyncCallback,Int32 creationTimeout)

在System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)

在System.Net.Mail。 SmtpClient.GetConnection()

在System.Net.Mail.SmtpClient.Send(MailMessage消息)

System.Net.Sockets.SocketException

消息:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应108.177.111.108:587

StackTrace:在System.Net .Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)

在System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,Socket& socket,IPAddress&地址,ConnectSocketState状态,IAsyncResult asyncResult,Exception&例外)



我的尝试:



SmtpClient smtp = new SmtpClient();

smtp.Host =smtp.gmail.com;

smtp.Port = 587;

smtp.UseDefaultCredentials = false;

smtp.EnableSsl = true;

smtp.Credentials = new NetworkCredential(abc@gmail.com,abc);

smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

facing error while sending email from live server.


Date : 5/29/2019 12:27:16 PM

System.Net.Mail.SmtpException
Message : Failure sending mail.
StackTrace : at System.Net.Mail.SmtpClient.Send(MailMessage message)
at AliAndAssociates.ApplicationForms.CrossNoticeManagement.CrossNoticeForm.Message()
at AliAndAssociates.ApplicationForms.CrossNoticeManagement.CrossNoticeForm.UCMemoButtonToolBar_SaveEvent(Object sender, EventArgs e)
System.Net.WebException
Message : Unable to connect to the remote server
StackTrace : at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, 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.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
System.Net.Sockets.SocketException
Message : 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 108.177.111.108:587
StackTrace : at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

What I have tried:

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("abc@gmail.com", "abc");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

推荐答案

您应该使用自己的SMTP服务器。 Google邮件通常不允许您以这种方式使用其服务器。



请参阅Richard Deeming的评论。
You should use your own SMTP server. Google mail does not generally allow you to use its server in this way.

See Richard Deeming's comments below.


这篇关于无法连接远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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