Gmail 错误:SMTP 服务器需要安全连接或客户端未通过身份验证.服务器响应为:5.5.1 Authentication Required [英] Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

查看:96
本文介绍了Gmail 错误:SMTP 服务器需要安全连接或客户端未通过身份验证.服务器响应为:5.5.1 Authentication Required的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码发送电子邮件.代码在我的本地机器上正常工作.但是在生产服务器上我收到错误消息

I am using following code to send email. The Code works correctly in my local Machine. But on Production server i am getting the error message

var fromAddress = new MailAddress("mymailid@gmail.com");
var fromPassword = "xxxxxx";
var toAddress = new MailAddress("yourmailid@yourdoamain.com");

string subject = "subject";
string body = "body";

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient
{
    Host = "smtp.gmail.com",
    Port = 587,
    EnableSsl = true,
    DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network,
    UseDefaultCredentials = false,
    Credentials = new NetworkCredential(fromAddress.Address, fromPassword)       
};

using (var message = new MailMessage(fromAddress, toAddress)
{
    Subject = subject,
    Body = body
})

smtp.Send(message);

在我的 Gmail A/c 上,我从生产服务器运行代码后收到以下电子邮件

And on my Gmail A/c I have received the following email after i ran the code from production server

最近有人使用您的密码尝试登录您的 Google帐户 mymailid@gmail.com.此人正在使用这样的应用程序作为电子邮件、客户端或移动设备.

Someone recently used your password to try to sign in to your Google Account mymailid@gmail.com. This person was using an application such as an email, client or mobile device.

我们阻止了登录尝试,以防这是劫机者试图访问您的帐户.请查看登录尝试的详细信息:

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

2014 年 1 月 3 日星期五 13:56:08 点 UTC IP 地址:xxx.xx.xx.xxx(abcd.net.) 地点:美国宾夕法尼亚州费城宾夕法尼亚州费城

Friday, 3 January 2014 13:56:08 o'clock UTC IP Address: xxx.xx.xx.xxx (abcd.net.) Location: Philadelphia PA, Philadelphia, PA, USA

如果您无法识别此登录尝试,则可能是其他人试图访问您的帐户.您应该登录您的帐户并立即重置您的密码.

If you do not recognise this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately.

重置密码

如果这是您并且在访问您的帐户时遇到问题,完成列出的故障排除步骤http://support.google.com/mail?p=client_login

If this was you and you are having trouble accessing your account, complete the troubleshooting steps listed at http://support.google.com/mail?p=client_login

此致,Google 帐户团队敬上

Yours sincerely, The Google Accounts team

推荐答案

当您尝试从不同的时区或 IP 地址计算机登录时,通常会发生这种情况.您的生产服务器和您使用的邮件 ID 位于不同的时区.选择以下两种解决方案之一:

This generally happens when you try login from different time zone or IP Address Computer. Your production server and the mail id you have used both are in different time zone. Choose either of these two solutions:

1) 通过远程访问登录到生产服务器,并使用您的凭据登录一次 gmail.他们会要求确认,确认并退出.

1) Log in to production server via remote access, and sign in to gmail once with your credentials. They will ask for the confirmation, confirm it and log out.

或 2) 将 gmail 登录到您的本地计算机,按照此链接 并选择查看此活动并采取适当的措施.

Or 2) log in gmail to your local computer, Follow this Link and choose review this activity and take proper actions.

这篇关于Gmail 错误:SMTP 服务器需要安全连接或客户端未通过身份验证.服务器响应为:5.5.1 Authentication Required的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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