tags:

views:

39

answers:

2

I'm building a mail client which uses a unique identifier to identify (duh) a conversation and by doing so creating a thread. This unique id is now attached to the subject line. Without the id in the subject line the mail gets 'lost'.

Besides the fact it clothers the subject line it would be much handier if i could add the id to a custom header like so:

$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: Webmaster <[email protected]>' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-myID: MghT3s' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Is this possible? And would the mail get a higher spam score by doing so?

//edit By replying to the send email with the custom header, the header is not being transfert, so this is indeed not a solution.

//edit2 I'm looking into the in-reply-to header. But don't know if it's used by all email clients.

+3  A: 

Yes, it's possible, and no, you probably won't get a higher spam score. Any header beginning with 'X-' is a legitimate extended header. There are many of these, having to do with spam filtering software, email distribution lists, etc.

Having an extended header is not prima facie evidence of being spam.

But are you sure you don't want to use the In-Reply-To header or the existing unique message IDs (Message-ID) to build a thread?

Borealid
+1 for reference to the In-Reply-To header, the correct approach to this problem... RFC2822 Section 3.6.4 and Appendix 2
Mark Baker
But is the in-reply-to header being used by all mail clients?
richardverbruggen
@richardverbruggen : in a word, yes.
Borealid
+1  A: 

How could this header solve your problem if user will reply with his own mail agent? In another words, reply will be sent without X-myID header.

The common way for tracking messages is adding Conversation ID to subject or to the text and telling users not to delete original mail text or modifying headers.

About beeing marked as SPAM because of headers - I don't really think so.

Kirzilla