使用Yahoo发送电子邮件时出现问题 [英] Problem on sending email using yahoo
问题描述
你好
我将使用yahoo帐户发送电子邮件.
I am going to send the email using yahoo account.
这是我的代码.
System.Net.Mail.MailMessage消息=新的System.Net.Mail.MailMessage("myaccount@yahoo.com","toaddress,"Test","Test"));
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("myaccount@yahoo.com", "toaddress, "Test", "Test");
System.Net.Mail.SmtpClient emailClient =新的System.Net.Mail.SmtpClient();
System.Net.Mail.SmtpClient emailClient = new System.Net.Mail.SmtpClient();
emailClient.Host ="smtp.mail.yahoo.com";
emailClient.Host = "smtp.mail.yahoo.com";
emailClient.Credentials =新的System.Net.NetworkCredential("myaccount@yahoo.com","mypassword");
emailClient.Credentials = new System.Net.NetworkCredential("myaccount@yahoo.com", "mypassword");
emailClient.Port = 465;
emailClient.Port = 465;
emailClient.EnableSsl = true;
emailClient.EnableSsl = true;
emailClient.Send(消息);
emailClient.Send(message);
(我没有写我的真实Yahoo帐户和密码.)
(I didn't write my real yahoo account & password.)
运行此代码时,出现错误消息"远程主机强行关闭了现有连接".
When I run this code, I get the error message 'An existing connection was forcibly closed by the remote host'.
你知道为什么吗?
何时将端口设置为25并将ssl设置为"false",我都没有问题.
I have no problem when to set the port to 25 and set to the ssl to 'false'.
请帮助我!
多谢建议.
推荐答案
使用 emailClient.Port = 587;
并制作
emailClient.EnableSsl = false;
希望它现在可以正常工作.
hope it will work now.
您可以检查以下链接
http://blog.e-rains.com/?p=105
http://blog.e-rains.com/?p=105
http://www.c-sharpcorner.com/UploadFile/Blogs/4111/
http://www.c-sharpcorner.com/UploadFile/Blogs/4111/
等待响应.
这篇关于使用Yahoo发送电子邮件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!