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

后端 未结 25 2256
悲&欢浪女
悲&欢浪女 2020-11-22 02:12

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 fromAddres         


        
相关标签:
25条回答
  • 2020-11-22 02:52

    You should disallow less secure apps to access your google account.

    to do:

    https://myaccount.google.com/lesssecureapps

    0 讨论(0)
  • 2020-11-22 02:53

    I'm a google apps for business subscriber and I spend the last couple hours just dealing with this, even after having all the correct settings (smtp, port, enableSSL, etc). Here's what worked for me and the web sites that were throwing the 5.5.1 error when trying to send an email:

    1. Login to your admin.google.com
    2. Click SECURITY <-- if this isn't visible, then click 'MORE CONTROLS', and add it from the list
    3. Click Basic Settings
    4. Scroll to the bottom of the Basic Settings box, click the link: 'Go to settings for less secure apps'
    5. Select the option #3 : Enforce access to less secure apps for all users (Not Recommended)
    6. Press SAVE at the bottom of the window

    After doing this my email forms from the website were working again. Good luck!

    0 讨论(0)
  • 2020-11-22 02:56

    Hi I had the same issue,

    what I've done to solve it. is to turn on the less secure app. after connecting to my gmail account. I entered this link: https://www.google.com/settings/security/lesssecureapps

    Then I turn on the secure app and, and the it worked. it has been said also above

    0 讨论(0)
  • 2020-11-22 02:56

    Just follow the step in the google email and enable less secure apps.

    0 讨论(0)
  • 2020-11-22 02:59

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

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

    0 讨论(0)
  • 2020-11-22 03:00

    What worked for me was to activate the option for less secure apps (I am using VB.NET)

    Public Shared Sub enviaDB(ByRef body As String, ByRef file_location As String)
            Dim mail As New MailMessage()
            Dim SmtpServer As New SmtpClient("smtp.gmail.com")
            mail.From = New MailAddress("from@gmail.com")
            mail.[To].Add("to@gmail.com")
            mail.Subject = "subject"
            mail.Body = body
            Dim attachment As System.Net.Mail.Attachment
            attachment = New System.Net.Mail.Attachment(file_location)
            mail.Attachments.Add(attachment)
            SmtpServer.Port = 587
            SmtpServer.Credentials = New System.Net.NetworkCredential("user", "password")
            SmtpServer.EnableSsl = True
            SmtpServer.Send(mail)
        End Sub
    

    So log in to your account and then go to google.com/settings/security/lesssecureapps

    0 讨论(0)
提交回复
热议问题