远离Gmail SMTP服务器,还是还有其他选择?
由于Google停止较少安全的应用程序功能功能更难更难使用其SMTP服务器发送电子邮件,我已经迁移到另一个提供商。
现在,我要获得STMP服务器需要安全的连接,否则客户端未经身份验证。服务器响应是:需要身份验证5.7.0。
该代码与Gmail的Out Out SMTP运行良好,但我的新服务器正在抱怨。我尝试了几种代码变化,结果是相同的。
private void SendEmail()
{
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient("smtp-relay.sendinblue.com");
message.From = new MailAddress("[email protected]");
message.To.Add("[email protected]");
message.Subject = "NEW LICENCE REQUEST FROM " + ((User) this.Session["User"]).Name;
message.Body = "LICENCE DEATIL" + Environment.NewLine + "SELLER = " + ((User) this.Session["User"]).Name + Environment.NewLine + "ID = " + this.TextBox__id.Text + Environment.NewLine + "NAME = " + this.TextBox__register_nam.Text + Environment.NewLine + "ADDRESS = " + this.TextBox__address.Text + Environment.NewLine + "LIC = " + this.TextBox__licence.Text + Environment.NewLine + "PDA = " + this.TextBox__pda.Text + Environment.NewLine + "CONTACT = " + this.TextBox__contact.Text + Environment.NewLine + "PHONE = " + this.TextBox__phone.Text + Environment.NewLine + "EMAIL = " + this.TextBox__email.Text + Environment.NewLine + "EXP = " + this.Calendar.SelectedDate.ToShortDateString() + Environment.NewLine + "AD SCREEN = " + this.CheckBox__AdScreen.Checked.ToString() + Environment.NewLine + "Biometrics = " + this.CheckBox__Biometrics.Checked.ToString() + Environment.NewLine + "Debit = " + this.CheckBox__Debit.Checked.ToString() + Environment.NewLine + "Draft = " + this.CheckBox__DraftControl.Checked.ToString() + Environment.NewLine + "KitchenScreen = " + this.CheckBox__KitchenScreen.Checked.ToString() + Environment.NewLine + "LiquorControl = " + this.CheckBox__LiquorControl.Checked.ToString() + Environment.NewLine + "WinAuthorize = " + this.CheckBox__WinAuthorize.Checked.ToString() + Environment.NewLine + "Lite = " + this.CheckBox__Lite.Checked.ToString() + Environment.NewLine + "CashNoBill = " + this.CheckBox__DisableCashNoBill.Checked.ToString();
smtpClient.Port = 587;
smtpClient.Credentials = (ICredentialsByHost) new NetworkCredential("[email protected]", "XSnfc213213216");
smtpClient.EnableSsl = true;
smtpClient.Send(message);
}
出于隐私原因,凭证已更改。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想留在Gmail SMTP中,您有一些选择。无论哪种方式,您的错误
意味着您需要进行身份验证才能使用该SMTP服务器。这意味着您需要配置OAuth2。与Google SMTP服务器一起使用的Simlar to XoAuth版本的Simlar。我将检查该新服务器的文档,它应该告诉您如何配置授权。
的Google SMTP选项
在删除较不安全的应用程序功能之后,下面
是使用Google SMPT服务器的两种方法。 XOAuth2
以下代码显示了如何将XOAuth2与Google SMTP服务器一起使用。它要求您在Google Cloud Cloud Console 上创建安装的应用程序凭证。
应用程序密码
另一个选项是创建 apps passwords密码您之前使用的密码的位置。
smtp用户名的快速修复和密码不接受错误
If you would like to stay with gmail smtp you have a few options. Either way your error
Means that you need to be authentication in order to use that smtp server. Which means you would need to configure Oauth2. Something simlar to the xoauth version below that works with googles smtp server. I would check the docs for this new server it should tell you how to configure authorizaiton.
Google SMTP options below
The following are two ways to use googles smpt server after the removal of less secure apps feature.
xoauth2
The following code shows how to use XOauth2 with Googles smtp server. It requires that you create installed app credentials on Google cloud console.
Apps password
Another option is to create an apps password and use that in place of the password you were using previously.
Quick fix for SMTP username and password not accepted error
看起来应用程序密码有效。您需要激活2个因子身份验证,然后Google为您提供16位数字密码。谢谢。
Looks like apps password worked. You need to activate 2 factor authentication and then google gives you a 16 digit password. Thanks.