无法建立连接,因为目标机器主动拒绝72.14.213.109:587

发布于 2024-10-11 20:39:23 字数 1647 浏览 2 评论 0原文

 //Create Mail Message Object with content that you want to send with mail.
        System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage("[email protected]", "[email protected]",
        "This is the mail subject", "Just wanted to say Hello");

        MyMailMessage.IsBodyHtml = false;

        //Proper Authentication Details need to be passed when sending email from gmail
        System.Net.NetworkCredential mailAuthentication = new
        System.Net.NetworkCredential("[email protected]", "myPassword");

        //Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587
        //For different server like yahoo this details changes and you can
        //get it from respective server.
        System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

        //Enable SSL
        mailClient.EnableSsl = true;

        mailClient.UseDefaultCredentials = false;

        mailClient.Credentials = mailAuthentication;

        mailClient.Send(MyMailMessage);

这是我的代码&它抛出错误: 无法建立连接,因为目标计算机主动拒绝它 72.14.213.109:587

代码参考:这里

请告诉我如何找到它?

 //Create Mail Message Object with content that you want to send with mail.
        System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage("[email protected]", "[email protected]",
        "This is the mail subject", "Just wanted to say Hello");

        MyMailMessage.IsBodyHtml = false;

        //Proper Authentication Details need to be passed when sending email from gmail
        System.Net.NetworkCredential mailAuthentication = new
        System.Net.NetworkCredential("[email protected]", "myPassword");

        //Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587
        //For different server like yahoo this details changes and you can
        //get it from respective server.
        System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

        //Enable SSL
        mailClient.EnableSsl = true;

        mailClient.UseDefaultCredentials = false;

        mailClient.Credentials = mailAuthentication;

        mailClient.Send(MyMailMessage);

Thats my code & it throws error :
No connection could be made because the target machine actively refused it 72.14.213.109:587

Code Reference : here

Please tell me how can i sought it out ??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

走野 2024-10-18 20:39:23

检查以下两点

1- 检查您的计算机上的端口 587 是否已打开

2- 检查您的防病毒软件是否阻止了与您的端口的连接

此致。

Check both of the following points

1- Check that this port 587 is open on your machine

2- Check if your antivirus is blocking the connection to your port

Regards.

素染倾城色 2024-10-18 20:39:23

如果您正在运行任何防病毒软件,请检查访问保护,取消阻止“防止群发邮件蠕虫发送邮件”

If your have any antivirus software running, check the access protection, unblock "prevent mass mailing worms from send mail"

只是一片海 2024-10-18 20:39:23

您实际上更改了用户名和密码吗?

Did you actually change the username and password?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文