Unable to send email via google smtp on centos VPS

后端 未结 5 1692
说谎
说谎 2021-01-03 10:35

I am trying to send email via google SMTP.

The code is working fine in my local windows PC in tomcat. But i got this error on my centos VPS

org.apach         


        
相关标签:
5条回答
  • 2021-01-03 10:42

    Your host name must be smtp.gmail.com if you are using SMTP and port number can be either 465 or 587. Your error log informs like your username or password is wrong so please ensure your account credentials and try again. Please have a look at this google mail client link.

    0 讨论(0)
  • 2021-01-03 10:51

    I got hung up on this... Make sure you set "Protocol" to SMTP+SSL. Otherwise follow instructions here: https://confluence.jetbrains.com/display/TCD8/Setting+up+Google+Mail+and+Google+Talk+as+Notification+Servers

    0 讨论(0)
  • 2021-01-03 10:52

    To enable send mail via gmail you must disable some security options in your gmail account: see https://support.google.com/accounts/answer/6010255

    0 讨论(0)
  • 2021-01-03 10:57

    Whenever a script tries to login automatically, Gmail generally blocks the script. To enable login through script do this:

    1. Go here https://security.google.com/settings/security/activity?hl=en&pli=1
    2. In the list of signin, select the one which was blocked and contains the IP of your server.
    3. Under Unusual activity click Change and Recognize the activity as yours.

    If you do not have the activity in the list goto https://accounts.google.com/b/0/DisplayUnlockCaptcha and then try.

    Both Tricks worked for me many times.

    0 讨论(0)
  • 2021-01-03 11:01

    Even if the Gmail account credentials are correct, Google may still block authentication attempt, suspecting a robot mail sender. To fix it, make sure you are logged in using the same Gmail account in your browser, and then open the link below and step through the process of verification:

    https://accounts.google.com/b/0/DisplayUnlockCaptcha

    This will allow access to your Gmail account for about 10 minutes. Be sure to try your code within this time frame.

    This trick helped me about half a year ago, hope nothing has been changed since then.

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