发送Hotmail电子邮件时出错 [英] error in sending hotmail email

查看:176
本文介绍了发送Hotmail电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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("youssef.obid@hotmail.com");
            mM.To.Add("youssef.obid@hotmail.com");
            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("youssef.obid@hotmail.com", "xxxxxx");
            sC.EnableSsl = true;
            sC.Send(mM);
        }
        catch (Exception ex)
        {
        }
    }

推荐答案

请使用端口587,如下所示:

Please use port 587 as indicated below:

User name: Your Windows Live ID, for example yourname@hotmail.com
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,

—MRB


这篇关于发送Hotmail电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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