Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the issue with Message-Id in email sent by php

I have suspicious message-id header of email sent by php to gmail account:

Message-Id: <[email protected]>

Could you please tell does it have this strange format and what SMTPIN_ADDED_MISSING means here? Examples I saw in the internet had format something like this containing sending domain but my message id doesn't contain it for some reason:

[email protected]

I don't think I set this header in Zend_Mail. What generates this headers? Do you see any issues with this header?

like image 791
Oleg Avatar asked Jan 23 '13 16:01

Oleg


People also ask

How do I fix PHP email?

If it's still not working: change the sender ($sender) to a local email (use the same email as used for recipient). Upload the modified php file and retry. Contact your provider if it still does not work. Tell your provider that the standard php "mail()" function returns TRUE, but not mail will be sent.

Why is my PHP email not sending?

If you've created a PHP mail form and find it's not sending email, then it's most often due to the FROM address the form is using in its headers. A simple way to confirm if this is the case: Log in to your web server via FTP or SSH.

How can I tell if PHP mail is delivered?

Well mail() simply returns a boolean value depending on whether the mail was successfully accepted for delivery. From the php.net site: Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

How does PHP mail send email?

PHP makes use of mail() function to send an email. This function requires three mandatory arguments that specify the recipient's email address, the subject of the the message and the actual message additionally there are other two optional parameters. mail( to, subject, message, headers, parameters );


2 Answers

A proper outbound email client should be generating the Message-ID header when the email is sent. Google is being 'nice' and generating it for you when the message passes through its email system, but most won't, and most spam filters will take this missing header as an indication that the message is more likely to be spam. Any malformed or missing headers will add to the "spam score".

It is not difficult to generate, all that is required is that it is unique per-message:

$message-id = time() .'-' . md5($sender . $recipient) . '@' $_SERVER['SERVER_NAME'];

Or

$message-id = time() .'-' . md5($sender . $recipient) . '@yourdomain.com';

Gives:

[email protected]
like image 164
Sammitch Avatar answered Sep 23 '22 06:09

Sammitch


Google SMTP generates it if missing. This header must be set by the first SMTP server. So you do not generate it - google does. It is used to prevent multiple delivery and to link related messages together.

It is not required to set message id header, but it's like a good practice for most (but not all, only configured) smtp to add (may be fix) this header. So to avoid generation of this header by others you can generate it by yourself.

like image 38
clover Avatar answered Sep 22 '22 06:09

clover