Skip Menu |

This queue is for tickets about the MIME-tools CPAN distribution.

Report information
The Basics
Id: 6297
Status: rejected
Priority: 0/
Queue: MIME-tools

People
Owner: Nobody in particular
Requestors: mprewitt [...] dmja.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 6.200_02
  • 5.411a
Fixed in: (no value)



Subject: MIME::Entity Message-Id patch
Just as MIME::Entity generates a X-Mailer header, why shouldn't it generate a Message-Id header? We found that some of our mail recipients using spam filters like spamassasin were getting messages incorrectly flagged as spam because the original message didn't contain a Message-Id. The message-id was being added by the first mailhost to receive the message (our outgoing mailserver). Here is a patch for 6.200_02 to add the header: --- Entity.pm 2004/05/13 17:28:01 1.1 +++ Entity.pm 2004/05/13 17:34:44 @@ -679,6 +679,13 @@ "MIME-tools ".(MIME::Tools->version). " (Entity " .($VERSION).")"); + + ### Add the Message-Id field, if top level (use default value if not given): + $top and $head->replace('Message-Id', + "<".(0+MIME::Tools->version). + "." .(0+$VERSION). "." . time . "." . + (0+($$||int(rand(9999)))) . "\@[127.0.0.1]>"); + ### Add remaining user-specified fields, if any: while (@paramlist) { my ($tag, $value) = (shift @paramlist, shift @paramlist); And here is one for 5.411a: --- Entity.pm 2004/05/13 17:11:43 1.1 +++ Entity.pm 2004/05/13 17:24:24 @@ -653,6 +653,13 @@ $top and $head->replace('X-Mailer', "MIME-tools ".(0+MIME::Tools->version). " (Entity " .(0+$VERSION).")"); + + ### Add the Message-Id field, if top level (use default value if not given): + $top and $head->replace('Message-Id', + "<".(0+MIME::Tools->version). + "." .(0+$VERSION). "." . time . "." . + (0+($$||int(rand(9999)))) . "\@[127.0.0.1]>"); + ### Add remaining user-specified fields, if any: while (@paramlist) { The only thing I'm not completely happy with is the @[127.0.0.1] on the rhs of the id. This should be a domain or machine name, but without using another library, there doesn't seem to be an easy way to get at that info. Anyway, [127.0.0.1] is valid so it certainly works.
Creating a Message-Id is the application's job, not the library's. Not all MIME is email, either, so a Message-Id isn't always appropriate. FWIW, it probably shouldn't generate an X-Mailer header either.