[exim] No immediate delivery for emails locally submitted in…

Top Page
Delete this message
Reply to this message
Author: Charles Leclerc
Date:  
To: exim-users
Subject: [exim] No immediate delivery for emails locally submitted in systemd unit
Hello,

I have a very strange behaviour on my exim servers (debian 11, version
4.94.2). I have systemd timers and units which send email in case of
error. When email is submitted this way, it is placed on the exim queue
without being immediately delivered and waits the next queue run as
specifed with the -q option (default 30 min). When I run the same submit
command from a shell, the mail is delivered immediately as expected.

The systemd unit configuration is the following :

ExecStopPost=-/bin/bash -c 'if [ "$EXIT_STATUS" != "0" ]; then mail -s
"ERROR executing arch-build" "$MAILTO" <<<"SYSTEMD status \n
Service_result: $SERVICE_RESULT \n Exit_code(systemd): $EXIT_CODE \n
Exit_status(proc exit code): $EXIT_STATUS\n`journalctl --no-pager -n 100
-u arch-build.service`"; fi'

When the unit stops, this option runs a shell script which checks the
service status and submits mail with a simple 'mail' command when
failed. Email is placed in the queue waiting as the exim logs show:

2023-08-24 11:38:32 1qZCTf-00A5Gx-Ns <= root@*****.edibox.ca U=root
P=local S=9329
2023-08-24 11:43:12 Start queue run: pid=2403642
2023-08-24 11:43:13 1qZCTf-00A5Gx-Ns => charles.leclerc@???
R=smarthost T=remote_smtp_smarthost H=*****.edibox.ca [172.25.1.2] K
C="250- 9017 byte chunk, total 9445\\n250 OK id=1qZCUL-0049vY-2h"
2023-08-24 11:43:13 1qZCTf-00A5Gx-Ns Completed
2023-08-24 11:43:13 End queue run: pid=2403642

When using the very same 'mail' command from a remote shell (or from a
shell script), the logs are :

2023-08-24 12:50:34 1qZDXW-00A7Y6-H1 <= root@*****.edibox.ca U=root
P=local S=417
2023-08-24 12:50:35 1qZDXW-00A7Y6-H1 => charles.leclerc@???
R=smarthost T=remote_smtp_smarthost H=*****.corp.edibox.ca [172.25.1.2]
K C="250- 432 byte chunk, total 432\\n250 OK id=1qZDXW-004EGB-Sp"
2023-08-24 12:50:35 1qZDXW-00A7Y6-H1 Completed

I've tried looking in the configuration but didn't find anything. Why
would delivering of identical, locally submitted emails, differ ?

Thanks for your answers,

Charles Leclerc
Edibox Inc.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/