SES 501 MAIL FROM Invalid

I searched the forum but couldn’t find an issue like this so here goes. I’ve successfully configured Exim to use Amazon SES. I have sent / received email via desktop mail client (SMTP) just fine. I can also send via command line if the FROM is set to an SES verified domain.

Example:

From: [email protected]
Subject: Foobar
This is a test.
.

The MAIL FROM is set to [email protected].

NOTE: I’m using domain.com for example.

When I use a PHP script with mailI() to process a contact form, the MAIL FROM is empty so SES returns a 501 Invalid.

SMTP error from remote mail server after MAIL FROM:<>: 501 Invalid MAIL FROM address provided

Has anyone come across something similar and how did you solve it? I’m not super familiar with Exim config and the documentation is a bit confusing.

I ended up using PHPMailer and direct SMTP to SES. However, I would still like to figure out how to make this work if possible.

using plain mail() functions nowadays is something you should avoid if possible. always authenticate via smtp properly (like it seems you did now).

SES will punish you if to many mails bounce, so you want to make sure, that it is not as easy as uploading a small php script to turn your server into a spamming machine :wink:

if you MUST, you probably want to look into setting proper headers with your mail() command - including the FROM address.