- Server operating system version
- Debian 12.14
- Plesk version and microupdate number
- 18.0.78 #1
Hello!
I'm having a problem when a Cron job needs to send an email notification via the external SMTP relay (MSMTP).
When I test it via SSH using the following command, I don't encounter any issues:
And this is what appears in /var/log/maillog:
May 21 00:50:07 serverName msmtp: host=smtp.ionos.fr tls=on auth=on user=[email protected] from=[email protected] recipients=[email protected] mailsize=202 smtpstatus=250 smtpmsg='250 Requested mail action okay, completed: id=1Mrh9Y-1xBDiN11qW-00h4I6' exitcode=EX_OK
But when the Cron job needs to send its notification, this is what appears in the same log:
May 21 01:11:06 serverName msmtp: host=smtp.ionos.fr tls=on auth=on user=[email protected] from=[email protected] recipients=[email protected] smtpstatus=554 smtpmsg='554-Transaction failed\n554-Reject due to policy restrictions.\n554 For explanation visit https://www.ionos.com/help/index.php?id=2425... errormsg='the server did not accept the mail' exitcode=EX_UNAVAILABLE
According to Ionos (https://www.ionos.com/help/index.php?id=2425#c138273), this is apparently due to the email being sent in the wrong format:
Is there anything I can do to fix this?
I'm having a problem when a Cron job needs to send an email notification via the external SMTP relay (MSMTP).
When I test it via SSH using the following command, I don't encounter any issues:
Code:
echo -e "Subject: SMTP config confirmation\n\nEmail to confirm the SMTP configuration in MSMTP." | msmtp --debug [email protected] [email protected]
May 21 00:50:07 serverName msmtp: host=smtp.ionos.fr tls=on auth=on user=[email protected] from=[email protected] recipients=[email protected] mailsize=202 smtpstatus=250 smtpmsg='250 Requested mail action okay, completed: id=1Mrh9Y-1xBDiN11qW-00h4I6' exitcode=EX_OK
But when the Cron job needs to send its notification, this is what appears in the same log:
May 21 01:11:06 serverName msmtp: host=smtp.ionos.fr tls=on auth=on user=[email protected] from=[email protected] recipients=[email protected] smtpstatus=554 smtpmsg='554-Transaction failed\n554-Reject due to policy restrictions.\n554 For explanation visit https://www.ionos.com/help/index.php?id=2425... errormsg='the server did not accept the mail' exitcode=EX_UNAVAILABLE
According to Ionos (https://www.ionos.com/help/index.php?id=2425#c138273), this is apparently due to the email being sent in the wrong format:
554 Transaction failed, reject due to policy restrictions
Problem:
The email was rejected by the IONOS SMTP server because the standards defined in RFC 5321 and RFC 5322 were not adhered to.
Solution:
The email client must meet the following criteria:
Note: The To and CC lines can contain multiple recipients.
- The header lines of the email must contain exactly one valid "Date" line according to RFC 2822.
- The following header lines may only exist once: From, Sender, To, CC, Subject
- The header lines mentioned must be syntactically correct
Is there anything I can do to fix this?