0

This is my properties part :

mail:
        host: smtp.gmail.com
        port: 587
        username: username 
        password: password
        protocol: smtp
        default-encoding: UTF-8
        properties: 
            auth: true
            starttls.enable: true
            starttls.required: true
            ssl.trust: smtp.gmail.com

But i get this error :

org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. q8-v6sm24909647wrj.97 - gsmtp

user3364181
  • 531
  • 3
  • 14
  • 32
  • please refer https://stackoverflow.com/questions/10509699/must-issue-a-starttls-command-first. try port: 465 – Bejond Aug 01 '18 at 09:23
  • if i only change prot to 465 i get : org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 – user3364181 Aug 01 '18 at 09:42
  • Have you tried following the documented tip? https://www.jhipster.tech/tips/011_tip_configuring_email_in_jhipster.html – Jon Ruddell Aug 01 '18 at 17:14
  • well yeah, i did that as you can see above but still not working – user3364181 Aug 02 '18 at 07:35

2 Answers2

0

Please try with the following settings. It worked for me.

mail:
   host: smtp.gmail.com
   port: 587
   username: username
   password: password
   protocol: smtp
   properties: 
      mail.smtp.auth: true
      mail.smtp.starttls.enable: true
Unheilig
  • 16,196
  • 193
  • 68
  • 98
0

For my humble opinion You should do as following:

  mail:
    host: smtp.gmail.com
    port: 587
    username: <username-email-here>@gmail.com
    password: <email-password-here>
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true