good day!
sorry for so "clear" question, let me explain. In my "program", i'm sending some emails, through (for example) gmail SMTP server. Let's pretend that every email, which i've sent, contains some unique ID (generated by me) in header. Is there any chance, after retrieving that messages from gmail (for example, with python imaplib), i will get that unique ID (in header) again?
thanks
send message through SMTP with guarantee ID
1.6k Views Asked by Anton Koval' At
2
There are 2 best solutions below
0

I just did a little testing on this, and it looks possible and actually pretty easy.
I used the Mail.php extension to make this happen (shouldn't matter, though). I added an extra header before I sent the message ("Trevor" => "My Test"). I received the message in Gmail and did a "Show Original" and it contains the header.
I then pulled this message down (also via PHP) and the header contains the custom line I entered.
In general, MTAs will preserve whatever message headers you introduce. Relaying MTAs are required to do so:
And in general the receiving MTA will also just add further headers related to message receipt, spam checking, loop detection, and the like. So yes, you're almost certainly going to be safe regardless of which destination SMTP server you use, GMail or otherwise.
If the IDs truly are unique, you may want to consider using them as part of your
Message-ID
header value. The benefit of usingMessage-ID
for this purpose is that when users reply to your message, they will generally include thatMessage-ID
value in theirIn-Reply-To
and/orReferences
header: