问题描述
我正在使用Visual Studio 2008(C#语言),并且尝试通过Web应用程序发送hotmail电子邮件,但出现此错误
I am using visual studio 2008 (C# language) and I am trying to send hotmail email via my web application but I get this error
"No connection could be made because the target machine actively refused it 65.55.162.200:25"
谁能帮我.
我的代码是:
Can anyone help me please.
My code is:
public void sendEMailThroughHotMail()
{
try
{
MailMessage mM = new MailMessage();
mM.From = new MailAddress("[email protected]");
mM.To.Add("[email protected]");
mM.Subject = "your subject line will go here";
mM.Body = "Body of the email";
mM.IsBodyHtml = true;
SmtpClient sC = new SmtpClient("smtp.live.com");
sC.Port = 25;
sC.Credentials = new NetworkCredential("[email protected]", "xxxxxx");
sC.EnableSsl = true;
sC.Send(mM);
}
catch (Exception ex)
{
}
}
推荐答案
User name: Your Windows Live ID, for example [email protected]
Password: The password you usually use to sign in to Hotmail or Windows Live
SMTP server: smtp.live.com (Port 25 or 587)
Authentication required? Yes (this matches your POP username and password)
TLS/SSL required? Yes
该讨论论坛中的主题还指出,仅允许TLS
,不允许 SSL
:
http://forums.mozillazine.org/viewtopic.php?f=39&t=1093155 [^ ]
更新:
在StackOverflow上有一个讨论,展示了如何使用ServicePointManager
来利用 TLS :
http://stackoverflow.com/questions/7082315/smtpclient-wont-authenticate-over-ssl-tls-not-pointing-to-gmail [ ^ ]
最好的问候,
The thread in this discussion forum also states that only TLS
is allowed and not SSL
:
http://forums.mozillazine.org/viewtopic.php?f=39&t=1093155[^]
Update:
At StackOverflow there is a discussion that shows how to use the ServicePointManager
to utilize TLS:
http://stackoverflow.com/questions/7082315/smtpclient-wont-authenticate-over-ssl-tls-not-pointing-to-gmail[^]
Best Regards,
这篇关于发送Hotmail电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!