Out of curiousity, have you tried seeing what Mail::Message makes of it? (Not suggesting that your $job would let you switch, just curious about the side-by-side comparison on the same, broken email.)

My frequent worry about Email::Simple is that it might be too simple in how it deals with things that aren't standards compliant. I've had good luck with Mail::Message in the past -- I've accepted its heavier weight and learning curve for the robustness I've seen on broken emails.

The following code should be a quick test if you've got it installed. (Read STDIN, print addresses to STDOUT).

use strict; use warnings; use Mail::Message; local $\ = "\n"; my $msg = Mail::Message->read(\*STDIN); print $_->format for $msg->to;

Update: I went ahead and quickly tried it on a sample email -- adding an extra "to:" header after all the other headers. The sample code above gave both the "To:" and "to:" addresses.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


In reply to Re: Spammers exploiting Email::Simple by xdg
in thread Spammers exploiting Email::Simple by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.