Not able to send mail by editting mail in traccar.xml

Knape4 years ago

First of all: It's a great application wich I use while hiking. Thanks for all effort.

I really tried to solve my send mail problem but... It don't work.
What is my problem: What I'm doing wrong ??

Hardware Raspberry PI4

    <entry key='mail.smtp.host'>smtp.kpnmail.nl</entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.starttsl.enable'>true</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.from'>XXXXXXXX@gmail.com</entry>
    <entry key='mail.smtp.username'>XXXXXXXkpnplanet.nl</entry>
    <entry key='mail.smtp.password'>12345678</entry> -->
2020-05-28 09:32:55  WARN: Report failed - 501 5.1.3 Bad recipient address syntax
 - SMTPAddressFailedException (... < MailManager:143 < ReportResource:82 < ...)

I also tried my gmail account but stl not able to send mail.

    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry> -->
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.from'>XXXXXX@gmail.com</entry>
    <entry key='mail.smtp.username'>XXXXXXXX@gmail.com</entry>
    <entry key='mail.smtp.password'>12345678</entry> --> 
2020-05-28 09:58:39  WARN: Report failed - 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials l60sm4396984ede.32 - gsmtp
 - AuthenticationFailedException (... < MailManager:139 < ReportResource:82 < ...)
Anton Tananaev4 years ago

I think the errors are pretty self explanatory. In the first case recipient address is an invalid email. In the second case login credentials are simply incorrect.

Anders Yuran4 years ago

Gmail will not accept your normal password anymore. You must go in to your google account and create an app password. Then it will work again. To be able to create the app pass you need to have 2-step authentication activated in your google account

Knape4 years ago

Gmail response in traccar.log:

553 5.1.3 The recipient address <admin> is not a valid RFC-5321 address. g23sm9967797edh.59 - gsmtp
 - SMTPAddressFailedException (... < MailManager:143 < *:92 < NotificatorMail:34 < NotificationResource:63 < ...)

Settings traccar.xml

    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>587</entry>
    <entry key='mail.smtp.starttsl.enable'>true</entry>
    <entry key='mail.smtp.from'>my_account@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>my_account@gmail.com</entry>
    <entry key='mail.smtp.password'>app_ password_gmail</entry>

setting account traccar attributes

Mail: SMTP host = smtp.gmail.com
Mail: SMTP username = my_account@gmail.com
Mail: SMTP password = app_password_gmail
Mail: SMTP port = 587
Mail: SMTP from = my_account@gmail.com
Mail: SMTP STARTTL Enable = true
Mail: SMTP SSL Enabled = true

As far I can see should the programming of mail parameters in traccar.xml and attribute-setting account correct.
What am I missing?
Mail: SMTP authenticatie Enabled = true

Frank Meier4 years ago

my settings with GMAIL which work...

<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'>xxx@gmail.com</entry>
<entry key='mail.smtp.auth'>true</entry>
<entry key='mail.smtp.username'>xxx@gmail.com</entry>
<entry key='mail.smtp.password'>xxx</entry>
Knape4 years ago

Hi Frank, these my result with the same parameters:

530 5.7.0 Must issue a STARTTLS command first. k2sm10122379ejv.71 - gsmtp - SMTPSendFailedException (... < MailManager:143 < *:92 < NotificatorMail:34 < NotificationResource:63 < ...)

Did you also add Attributes on the relevant account with admin rights?

Mail: SMTP host = smtp.gmail.com
Mail: SMTP Username =my-account@gmail.com
Mail: SMTP Password = app_password_gmail
Mail: SMTP Port = 587
Mail: SMTP From= my_account@gmail.com
Mail: SMTP Auth Enabled = true

I'm gone get crazy after one week of looking for my Eureka moment........

Anton Tananaev4 years ago

Knape, why are you keep ignoring error messages? It clearly tells you that recipient address is invalid. Have you fixed it? It looks like you are using admin user, which has "admin" as an email value, which is clearly invalid.

Anton Tananaev4 years ago

I've added a documentation page for Gmail with detailed step by step guide:

https://www.traccar.org/gmail/