I tried to get Monit to send emails with my SparkPost account but ran into an unexpected error.
My monitrc is like so (where mydomain.com is a properly configured sending domain on my SparkPost account):
set mail-format { from: postmaster@mydomain.com }
set mailserver
smtp.sparkpostmail.com
port 587
username "SMTP_Injection"
password "mypassword"
using tlsv1
with timeout 30 seconds
using hostname "mydomain.com"
set alert alerts@mydomain.com
Looking at monit logs I get the following error:
Sendmail: 550 5.7.1 Unconfigured Sending Domain <localhost>
When trying to test it locally with swaks, it works as expected:
swaks -server smtp.sparkpostmail.com:587 -tls --auth-user SMTP_Injection --auth-password mypassword --to alerts@mydomain.com --from postmaster@mydomain.com
I don't understand where the <localhost>
is coming from in the error message as the hostname is explicitly set to mydomain.com
.