0

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.

1 Answers1

0

Try changing "hostname" option to uppercase. These are working for me:

set mailserver
  smtp.sparkpostmail.com
  port 587
  username SMTP_Injection
  password <api-key-here>
  using ssl with options {
    version: tlsv1
  }
  using HOSTNAME mydomain.com

set mail-format { from: monit@mydomain.com }

set alert me@mydomain.com
Pavel
  • 1
  • 1
  • Thanks but still not working. I'm on version 5.6 and I suspect the syntax of the configuration file might have changed compared to the documentation as when I put `using ssl with option` it gives an error message. What version are you on? – Daniel Ristic Mar 01 '17 at 18:09
  • I'm on 5.16, but the same is also working on 5.20. You don't forget `s` in `using ssl with options`, do you? – Pavel Mar 02 '17 at 18:48