Traccar 3.7 SMTP Issue

Jake Stephens8 years ago

I am after some help. I have just upgraded to v3.7 and I can't seem to get the email notifications working. I never looked at this in v3.6 so this is the first time setting this up. Note: I'm using a GMail email account to send alerts from.

I have tried every single SMTP combination SSL/TLS different combination of ports etc with no avail. I've enabled less secure third party access within the GMail account.

My current config is below:

   <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>myemail@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>myemail@gmail.com</entry>
    <entry key='mail.smtp.password'>mypassword</entry>

I found this config on another post and played around with the config but have been unsuccessful.

    <entry key='mail.smtp.host'>smtp.example.com</entry>
    for STARTTLS
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.starttls.enable'>true</entry>
    for SSL
    <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'>traccar@example.com</entry>
    <entry key='mail.smtp.password'>password</entry>

When I look in traccar-server.log I see this error:

2016-09-11 13:48:55  WARN: Could not connect to SMTP host: smtp.gmail.com, port: 587 - MessagingException (... < NotificationMail:135 < *:149 < ...)

I am able to telnet to smtp.gmail.com over port 587 so eliminates a firewall issue.

Any help or suggestions/cross reference other peoples SMTP configs would be appreciated.

Thank you in advance.
Jake

abyss8 years ago

Hello, you are trying to use SSL with port 587, but

right combinations is

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

OR

<entry key='mail.smtp.port'>465</entry>
<entry key='mail.smtp.ssl.enable'>true</entry>

Also, please check you enabled "less secure apps" for your google account https://support.google.com/accounts/answer/6010255?hl=en

abyss8 years ago

Also, I've got the same error this morning. May be there are some issues on gmail servers.

Jake Stephens8 years ago

Hi Abyss,

Thanks for that. I've tried all port combinations but as a sanity check I've done as you suggested and change it to:

<entry key='mail.smtp.port'>465</entry>
 <entry key='mail.smtp.ssl.enable'>true</entry>

However I still get the same error (different port).

2016-09-12 13:48:27  WARN: Could not connect to SMTP host: smtp.gmail.com, port: 465 - MessagingException (... < NotificationMail:135 < *:149 < ...)

I have a gmail account as a personal email same SMTP settings which is still working with no issues. :S

Tjeerd138 years ago

Do you have 2 factor authenticatie enabled?
Then you have to create an app Password

  1. Log-in into gmail with your account
  2. Navigate to https://security.google.com/settings/security/apppasswords
  3. In 'select app' choose 'custom', give it an arbitrary name and press generate
  4. It will give you 16 chars token.
Jake Stephens8 years ago

Hi,

I do have 2 factor auth enabled and have used the 16 digit as the SMTP password however still get the 'could not connect' error :(

I don't know if it's worth noting but when I use

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

I get the following error instead:

2016-09-12 14:13:41 WARN: Could not convert socket to TLS - MessagingException (... < NotificationMail:135 < *:149 < ...)

But using SSL & port 465 I get
2016-09-12 15:27:42 WARN: Could not connect to SMTP host: smtp.gmail.com, port: 465 - MessagingException (... < NotificationMail:135 < *:149 < ...)

Anton Tananaev8 years ago

Try to add following line to the config:

<entry key='mail.smtp.ssl.trust'>*</entry>

abyss8 years ago

Here is screenshot of 100% working configuration.
Account with 2 factor authentication and generated app password as suggested Tjeerd13
https://cloud.mail.ru/public/KKRB/LyHag3BAv

Also, try mail.smtp.ssl.trust as suggested Anton Tananaev.
But looks like you have some problems with SSL/TLS. May be your Java do not trust Google. Try update your java.

markus7 years ago

Hello Friends out there!

I played now the whole day long with the following problem. I am using an account from the Telekom-Austria which does not support SSL for outgoing mails. The following message was shown within the tracker-server.log.

2016-11-01 15:45:26 WARN: Could not convert socket to TLS - MessagingException (... < NotificationMail:135 < *:149 < ...)

After trying countless possibilities of ports and other settings written in this forum I solved the problem by removing (!!!) this line from the traccar.xml
<entry key='mail.smtp.starttls.enable'>true</entry>

By the way, the hint which helped me finally can be found here:
http://stackoverflow.com/questions/12743846/unable-to-send-an-email-using-smtp-getting-javax-mail-messagingexception-could

So finally my config looks like this:

<!-- EMAIL SETTINGS -->

<entry key='mail.smtp.host'>smtp.a1.net</entry>
<entry key='mail.smtp.port'>25</entry>
<entry key='mail.smtp.from'>traccar@aon.at</entry>
<entry key='mail.smtp.auth'>true</entry>
<entry key='mail.smtp.username'>USER/entry>
<entry key='mail.smtp.password'>PASSWORD</entry>

Enjoy ... yours
markus

Anton Tananaev7 years ago

@markus, thanks for sharing the information.

If possible, I would recommend to use a server that SSL or STARTTLS for security reasons.

Thiago Araújo7 years ago

Hi,

I'm just getting this error:

WARN: Could not connect to SMTP host: smtp.gmail.com, port: 465 - MessagingException (... < NotificationMail:110 < *:33 < *:127 < ...)

I have already tested all possible configurations posted in this forum.

My server is configured with Ubuntu 16.04.1 x64 and oracle java 1.7.0_80

Anton Tananaev7 years ago
Thiago Araújo7 years ago

I solved the problem.

The provider of my droplet (digital ocean) blocks the SMTP service on their network. I requested the release of the service and everything started working normally.

Sorry for the inconvenience!
Thank you.

markus7 years ago

Hi!

Updated from traccar 3.9 to 3.10 after completely new installation of my Raspberry Pi with Ubuntu Mate 16.04.2 LTS (former 15.10).

Tried the same traccar.xml file than I had in the older configuration. E-Mail Settings look like this:

    <!-- EMAIL SETTINGS -->

    <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@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>MYADDRESS@gmail.com</entry>
    <entry key='mail.smtp.password'>PASSWORD</entry>

With the old installation everything worked fine with this config. Now, with the new installation i get this one:

WARN: Unknown SMTP host: smtp.gmail.com - MessagingException (... < NotificationMail:115 < *:129 < ...)

or this one if I use the same Address for .from and .username:

WARN: Unknown SMTP host: smtp.gmail.com - MessagingException (... < NotificationMail:115 < *:66 < ...)

It's worth to say that my Mail-Account did not change (allowed Unsecure Apps and no 2-factor authentication).

I also had a very old E-Mail setting without STARTLS and without SSL on another server. This one still works but I don't want to be that insecure.

Any idea?

Thanks, yours
Markus

Anton Tananaev7 years ago

There is no difference between 3.9 and 3.10 in terms of email notifications, so if it worked for 3.9, it should work for 3.10 as well.