无法从ASP.Net以编程方式发送电子邮件 [英] Can not Send Email Programmatically from ASP.Net

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

问题描述

我不知道我是否在正确的论坛。如果没有,请重定向到正确的。


我尝试使用smtp.gmail.com作为电子邮件服务器以编程方式在ASP.Net中发送电子邮件。我的代码如下:

 MailMessage MyMailMessage = new MailMessage(); 
MyMailMessage.From = new MailAddress(" myAddress@gmail.com");
MyMailMessage.To.Add(" myDestination@sbcglobal.net");
MyMailMessage.Subject =" Programmatic Email" ;;
MyMailMessage.IsBodyHtml = true;
MyMailMessage.Body ="< table>< tr>< td>" +"我的第一个动态电子邮件" +"< / table>< / tr>< / td>" ;;
SmtpClient SMTPServer = new SmtpClient(" smtp.gmail.com");
SMTPServer.Port = 587;
SMTPServer.Credentials = new System.Net.NetworkCredential(" myAddress@gmail.com"," myGmailPassword");
SMTPServer.EnableSsl = true;
SMTPServer.Send(MyMailMessage);

我有一个例外情况如下:



SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应为:5.5.1需要身份验证。


我已在我的gmail设置中为外发电子邮件启用POP。


任何非常感谢帮助。










Goldstar Lee

解决方案

gmail是一个安全的电子邮件解决方案,所以你必须弄清楚如何验证客户端。


在错误消息上做谷歌你会得到很多点击和可能的解决方案。


SMTP服务器需要安全连接或客户端未经过身份验证。服务器响应是:5.5.1需要验证。


您也可以发布到论坛。


http://论坛.asp.net /


I don't know if I am in the right forum. If not, please redirect to the right one please.

I tried to send an email programmatically in ASP.Net using smtp.gmail.com as the email server. My code is below:

                MailMessage MyMailMessage = new MailMessage();
                MyMailMessage.From = new MailAddress("myAddress@gmail.com");
                MyMailMessage.To.Add("myDestination@sbcglobal.net");
                MyMailMessage.Subject = "Programmatic Email";
                MyMailMessage.IsBodyHtml = true;
                MyMailMessage.Body = "<table><tr><td>" + "My First Dynamic Email" + "</table></tr></td>";
                SmtpClient SMTPServer = new SmtpClient("smtp.gmail.com");
                SMTPServer.Port = 587;
                SMTPServer.Credentials = new System.Net.NetworkCredential("myAddress@gmail.com", "myGmailPassword");
                SMTPServer.EnableSsl = true;
                SMTPServer.Send(MyMailMessage);

I got an exception as follows:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

I already enable POP in my gmail setting for outgoing email.

Any help will be greatly appreciated.



Goldstar Lee

解决方案

gmail is a secure email solution so you'll have to figure out how to authenticate the client.

do a google on the error message you'll get lots of hits and possible solutions.

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

you can also post to the forum.

http://forums.asp.net/


这篇关于无法从ASP.Net以编程方式发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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