GMAIL and Traccar

S.System6 years ago

Hello, when I install smtp for Gmail i get this Message:

WARN: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 - MessageException (NotificatorMail:132 < Notificator:30 < ...)

My config ist this:

 <!-- STARTTLS Server -->
    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>traccar@example.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>xxxxxxxxxxx@gmail.com</entry>
    <entry key='mail.smtp.password'>PASSWORD</entry>

What is wrong ?

Thx und best Regards Stefan

Max JRB6 years ago

Try changing to TLS instead of SSL

<entry key='mail.smtp.port'>587</entry>
<entry key='mail.smtp.starttls.enable'>true</entry>

And enable the use of insecure apps in gmail security panel

S.System6 years ago

Hi Max thx for your info, but the service ist not working :-(

Now my config ist like this:

 <!-- STARTTLS Server -->
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.starttls.enable'>true</entry>
    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.from'>traccar@example.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>xxx@gmail.com</entry>
    <entry key='mail.smtp.password'>PASSWORD</entry>

The error code is the same.

WARN: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 - MessageException (NotificatorMail:132 < Notificator:30 < ...)

I have the 2 authentification at google on an the app password works very fine.

The test with smtp google and postfix is working fine.

Where can me help ??

Thx Stefan

Max JRB6 years ago

ok, first just use one port and one auth

<entry key='mail.smtp.port'>587</entry>
<entry key='mail.smtp.starttls.enable'>true</entry>
<entry key='mail.smtp.host'>smtp.gmail.com</entry>
<entry key='mail.smtp.from'>traccar@example.com</entry>
<entry key='mail.smtp.auth'>true</entry>
<entry key='mail.smtp.username'>xxx@gmail.com</entry>
<entry key='mail.smtp.password'>PASSWORD</entry>

second, you have two factor auth enabled on gmail?
I haven't tested with 2 fact auth on gmail, I enabled the less secure apps on gmail panel, check this post:
https://devanswers.co/allow-less-secure-apps-access-gmail-account/

bsaggarwal6 years ago

do note..while configuring google account for smtp with less secure apps option enabled...google sends out email alert for account access via unusual IP. you have to verify the access ( one time from email link) for email alerts to start working.