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

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

问题描述

我使用下面的code发送电子邮件。在code正常工作在我的本地机器。但是生产服务器上我得到错误信息

  VAR fromAddress =新MailAddress(mymailid@gmail.com);
        VAR fromPassword =XXXXXX;
        VAR的toAddress =新MailAddress(yourmailid@yourdoamain.com);

        字符串主题=主题;
        字符串身体=身体;

        System.Net.Mail.SmtpClient SMTP =新System.Net.Mail.SmtpClient
        {
            主机=smtp.gmail.com,
            端口= 587,
            EnableSsl = TRUE,
            DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network,
            UseDefaultCredentials =假,
            证书=新的NetworkCredential(fromAddress.Address,fromPassword)

        };

        使用(VAR消息=新MailMessage(fromAddress,的toAddress)
        {
            主题=主题,
            身体=人体
        })


        smtp.Send(消息);
 

和我的Gmail的A / C我收到了以下电子邮件后,我跑了code从生产服务器

  

您好,

     

最近有人使用您的密码来尝试登录到您的谷歌   帐户mymailid@gmail.com。此人使用的应用程序,例如   作为电子邮件,客户机或移动设备。

     

我们prevented的登录尝试的情况下,这是一个劫机者试图   访问您的帐户。请检查登录尝试的细节:

     

周五年,2014年1月3日13时56分08秒时UTC IP地址:xxx.xx.xx.xxx   位置(abcd.net):宾夕法尼亚州费城,宾夕法尼亚州费城,美国

     

如果您不认识这个登录尝试,别人可能   尝试访问您的帐户。你应该登录到您的帐户,   立即重置您的密码。

     

重置密码

     

如果这是你,你有访问帐户,   完成上市的故障排除步骤   <一href="http://support.google.com/mail?p=client_login">http://support.google.com/mail?p=client_login

     

此致,在谷歌帐户团队

解决方案

这通常发生在你尝试从不同的时区/ IP /电脑登录。你的生产服务器和邮件ID您使用两者在不同的时区。选择任意一个解决方案:

1)登录到生产服务器通过远程访问,同唱那首与您的凭据Gmail的一次。他们会要求确认,确认并退出。

或2)登录的Gmail到本地计算机,请按照以下链接并选择< A HREF =htt​​ps://security.google.com/settings/security/activity>回顾本次活动,并采取适当的行动。

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);

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

Hi ,

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:

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.

Reset password

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

Yours sincerely, The Google Accounts team

解决方案

This generally happens when you try login from different time zone/IP/Computer. You production server and the mail id you have used both are in different time zone. Choose any of the one solution:

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

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需要验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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