邮件发送有问题 [英] There is problem in mail sending

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

问题描述

我试过这段代码。但是它显示错误。



我尝试过:



System.Net.Mail.MailMessage Email = new System.Net.Mail.MailMessage(xyz@gmail.com,YourEmail.Text);

Email.Subject = YourSubject.Text;

Email.Body = Comments.Text;

System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient();

//此对象存储身份验证值

System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(xyz@gmail.com,9583364957);

//将您自己或您的ISP邮件服务器名称放在下一行

mailClient.Host =Mail.Gmail.com;

mailClient.UseDefaultCredentials = false;

mailClient.Credentials = basicAuthenticationInfo;

mailClient.Send(Email);

i have tried this code.but it shows error.

What I have tried:

System.Net.Mail.MailMessage Email = new System.Net.Mail.MailMessage("xyz@gmail.com", YourEmail.Text);
Email.Subject = YourSubject.Text;
Email.Body = Comments.Text;
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient();
//This object stores the authentication values
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("xyz@gmail.com", "9583364957");
//Put your own, or your ISPs, mail server name onthis next line
mailClient.Host = "Mail.Gmail.com";
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicAuthenticationInfo;
mailClient.Send(Email);

推荐答案

正确的SMTP主机对于gmail而言, smtp.gmail.com



我在gmail上看到的其他常见问题:



1. Google无法识别正在使用的特定电子邮件帐户所使用的连接。最好的办法是转到他们的登录活动页面并告诉他们是的,那就是我

登录 - Google帐户 [ ^ ]



2.默认情况下,Google会在安全性较低的前提下阻止SMTP访问。允许不安全应用允许SMTP访问的选项

帐户设置:不支持您的浏览器。 [ ^ ]
The correct SMTP host for gmail is smtp.gmail.com

Other common issues I have seen with gmail:

1. Google does not recognize the connection being used for the particular email account being used. The best thing to do is to go to their Login Activity page and tell them basically that "yes, that was me"
Sign in - Google Accounts[^]

2. Google by default blocks SMTP access under the premise that it is less secure. There is an option to allow "Less Secure Apps" which will allow SMTP access
Account settings: Your browser is not supported.[^]


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

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