发送电子邮件的问题 [英] problem with send email

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

问题描述

大家好

我想从我的网站发送电子邮件,我试过这段代码:



Hi all
I want send Email from my website , I tried this code :

MailMessage mm = new MailMessage();
mm.From = new MailAddress("FromMyEmail@gmail.com");
mm.Subject = "Hello World ";
mm.Body = "Hello World";
mm.IsBodyHtml = true;
mm.To.Add(new MailAddress("toEmail@hotmail.com"));
NetworkCredential nc = new NetworkCredential();
nc.UserName = "FromMyEmail@gmail.com";
nc.Password = "MyPassword";
SmtpClient sc = new SmtpClient();
sc.Host = "smtp.gmail.com";
sc.EnableSsl = true;
sc.UseDefaultCredentials = true;
sc.Credentials = nc;
sc.Port = 587;
sc.Send(mm);
mm.Dispose(); mm = null;
nc = null;
sc.Dispose(); sc = null;





但是我得到了这个例子:

SMTP服务器需要安全连接或者客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。了解更多信息



请帮助我。



But I get this Exeption :
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

help me please.

推荐答案

查看关于CP的类似讨论:

SMTP服务器需要安全连接或者客户端未经过身份验证。服务器响应为:5.5.1需要验证。 [ ^ ]
Check out similar discussion on CP:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.[^]


mm.To.Add(toEmail @ hotmail.com,tomail @ yahoo.com );
mm.To.Add("toEmail@hotmail.com,tomail@yahoo.com");


转到您的邮件服务器并检查您的防火墙设置。然后,在Gmail中,将您从帐户设置获得的服务器地址添加到其安全客户端列表。



请参阅此处类似的主题:

Microsoft.NET框架 - SMTP服务器需要安全连接或客户端未经过身份验证 [ ^ ]



--Amit
Go to your mail server and checke your firewall settings. Then, in gmail, add the server address that you got from your account settings, to their secured client list.

See the similar thread here:
Microsoft.NET framework - SMTP server requires a secure connection or the client was not authenticated[^]

--Amit


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

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