Hello
I am trying to send an email to gmail.com using PHP's mail() function and E-mailrelay.
I receive this error:
Messages missing a valid Message-ID header are not accepted (5.7.1). For more information, go to (5.7.1) https://support.google.com/mail/?p=RfcMessageNonCompliant and review RFC 5322 specifications.
If I create the header like this:
$message_id = "<" . uniqid() . "@domain.com>";
it works, but shouldn't E-mailrelay automatically generate and add this header to each email sent?
Thanks
Thanks for the feedback. It looks like you have a good solution to the problem.
Note that while a message-id field should be present it is not mandatory (see RFC-5322 3.6). The 'should be present' requirement is a quality-of-implementation issue for whatever assembles the original message content and submits it -- in your case, your PHP script and the PHP mail() function.
If your downstream service provider absolutely requires message-ids and messages might be submitted without one then you should generally use a filter script to add ids when required. Perhaps there should be a built-in filter to do that -- I will give that some thought.
Reviewing the documentation carefully, I see that E-mailrelay already has a built-in filter: msgid:
The msgid: filter adds an RFC-822 Message-ID header to the content file if it does not already have one.
I have activated the filter in the configuration file, and it works correctly. It is not necessary to create the Message-ID header in my PHP script.
The filter creates a header of the type:
Message-ID: 1727874345.612053.8028.2010@domain.com
You can close this ticket
Thanks
Yes, I remembered while I was out walking the dog :-<
I should note that the implementation of the filter is sub-optimal because it copies the whole content file in order to add one header line (it was a last minute addition to the release) so doing it in PHP might still be the better approach overall.