使用 Lotuslive 凭据从 C# 代码发送邮件?
我正在尝试使用 Lotuslive smtp 从 C# 代码发送邮件。但我没有成功发送邮件。每次它都会显示{“无法从传输连接读取数据:现有连接被远程主机强制关闭。”}。
我的代码对于 gmail 和 yahoo 等其他电子邮件主机运行良好。
下面是我使用过的代码。
MailMessage message = new MailMessage();
message.From = new MailAddress("fromaddress");
message.To.Add(new MailAddress("toaddress"));
message.Subject = "Test";
message.Body = "test";
SmtpClient client = new SmtpClient("companyname-com-smtp.mail.lotuslive.com", 465);
client.UseDefaultCredentials = false;
NetworkCredential credential = new NetworkCredential("companycredentials", "password");
client.Credentials = credential;
client.EnableSsl = true;
try
{
client.Send(message);
}
catch(Exception ex)
{
}
I am trying to send mail from C# code using lotuslive smtp. But I have no success in sending the mail. everytime it says {"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."}.
My code is working fine for other email hosts like gmail and yahoo.
below is the code that I have used.
MailMessage message = new MailMessage();
message.From = new MailAddress("fromaddress");
message.To.Add(new MailAddress("toaddress"));
message.Subject = "Test";
message.Body = "test";
SmtpClient client = new SmtpClient("companyname-com-smtp.mail.lotuslive.com", 465);
client.UseDefaultCredentials = false;
NetworkCredential credential = new NetworkCredential("companycredentials", "password");
client.Credentials = credential;
client.EnableSsl = true;
try
{
client.Send(message);
}
catch(Exception ex)
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果是跟踪帐户则可能会导致一些问题。
如果您没有演示帐户,请检查此链接 - 如何在 Outlook 2003 中配置客户端。
检查这些
outlook 配置设置
是否与您的代码设置匹配。如果所有这些都不是问题,那么可能是您的邮件服务器有问题。检查这些链接以获取信息:
现有连接被 SMTP 中的远程主机强制关闭客户端
System.Net.Mail 使用 SSL 对端口 465 进行身份验证
If it is trail account then may cause some problems.
If you do not have demo account then Check this link - How to configure client in Outlook 2003.
Check these
outlook configure settings
match to your code settings.If all this stuff is not the issue then it may be problem at your mail server. Check these links for information:
An existing connection was forcibly closed by the remote host in SMTP client
System.Net.Mail with SSL to authenticate against port 465