Issues setting up an SMTP Email Relay on debian

Hello,
I am trying to set up an SMTP mail relay on my Debian server using OpenSMTPD. I was following this SMTP setup tutorial and it seemed to be going smoothly, but I keep running into an issue when I keep sending an email.

Here is the command I’m using to send a test email:

echo "Test email body" | mail --subject="Test Subject" --append="From: monitoring@example.com" myemail@example.com

But I get an error message:

mail: cannot send message: Process exited with a non-zero status

I checked the logs using journalctl -f _COMM=smtpd, but I can’t figure out what’s wrong. The logs show:

Invalid recipient: <myemail@example.com>

Does anyone know what could be wrong here?
I changed the email names and such for privacy reasons.

Ok, so my first recommendation would “use Postfix”.

If you “apt install postfix” on a Debian system it will work right out of the box.

When you find that you can’t actually relay directly anymore and that you need to
chain on to an external service like “Mailjet” (or similar), you will be glad that the code to do this is available and well documented. (and typically “just works”)

If you take apart many of the “well known” systems that utilise SMTP servers (“maininabox” for example) , you will find that under the hood, many are using postfix.

In terms of pedigree, I believe “postfix” was originally contributed by “IBM”.

1 Like