E-mail sending issues (starttls)

Hi guys, I noticed the e-mail topics are very common here, but I’ve read few posts here and docs on Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja, but still can’t find out why my mails are not leaving.

Using docker
my env (obviously redacted)

PHP_VERSION=7.4.26
INVOICENINJA_VERSION=5.3.34
MAIL_FROM_ADDRESS=myuser@mydomain.com
MAIL_FROM_NAME=MyUser
MAIL_ENCRYPTION=starttls
MAIL_PASSWORD=password
MAIL_HOST=mailserver.hostname
MAIL_MAILER=smtp
MAIL_PORT=2525
QUEUE_CONNECTION=database

I can telnet to the smtp server on port 2525 directly from IN container.
Container was created with mentioned env values, but I’ve run php artisan optimize anyway.
I’m running tcpdump on smtp server to see all traffic from docker machine, but IN is not even trying to connect.

Docker log

10.0.1.5 -  13/Jan/2022:21:06:26 +0000 "POST /index.php" 200
[2022-01-13 21:06:29][45] Processing: App\Jobs\Mail\NinjaMailerJob
[2022-01-13 21:06:29][45] Processed:  App\Jobs\Mail\NinjaMailerJob

DB jobs is empty

MariaDB [ninja]> select * from jobs;
Empty set (0.000 sec)

DB system_logs not useful neither

MariaDB [ninja]> select * from system_logs;
+----+------------+---------+-----------+-------------+----------+---------+---------------------------+----------------------------+----------------------------+------------+
| id | company_id | user_id | client_id | category_id | event_id | type_id | log                       | created_at                 | updated_at                 | deleted_at |
+----+------------+---------+-----------+-------------+----------+---------+---------------------------+----------------------------+----------------------------+------------+
|  1 |          1 |       1 |      NULL |           5 |       61 |     800 | "{\"ip\":\"172.33.1.1\"}" | 2022-01-13 12:00:29.136819 | 2022-01-13 12:00:29.136819 | NULL       |
|  2 |          1 |       1 |      NULL |           5 |       61 |     800 | "{\"ip\":\"172.33.1.1\"}" | 2022-01-13 14:59:03.245867 | 2022-01-13 14:59:03.245867 | NULL       |
|  3 |          2 |       4 |      NULL |           5 |       61 |     800 | "{\"ip\":\"172.33.1.1\"}" | 2022-01-13 16:26:52.455798 | 2022-01-13 16:26:52.455798 | NULL       |
|  4 |          1 |       1 |      NULL |           5 |       61 |     800 | "{\"ip\":\"172.33.1.1\"}" | 2022-01-13 16:28:13.510892 | 2022-01-13 16:28:13.510892 | NULL       |
|  5 |          1 |       1 |      NULL |           5 |       61 |     800 | "{\"ip\":\"172.33.1.1\"}" | 2022-01-13 21:02:52.376577 | 2022-01-13 21:02:52.376577 | NULL       |
+----+------------+---------+-----------+-------------+----------+---------+---------------------------+----------------------------+----------------------------+------------+

System Logs in dashboard completely empty. Any idea where to look further?

Hi,

@david do you have any suggestions?

Looks like MAIL_ENCRYPTION=starttls is not supported. I think https://github.com/swiftmailer/swiftmailer/blob/master/doc/sending.rst is being used, so the correct value should be

MAIL_ENCRYPTION=tls

And this should include also STARTTLS.

This doesn’t work for me for some reason, but at least I can now see servers trying to communicate and it’s possible that the issue is in the my mail server STARTTLS implementation.

Setting to plain by

MAIL_ENCRYPTION=

or to SSL by

MAIL_ENCRYPTION=ssl
MAIL_PORT=587

both works for me.

Pity that the logs didn’t show anything ¯\(ツ)

1 Like

@JanM

That is quite bizarre, typically TLS = 587 and SSL = 465