From:
Justin J <justin@dadamailproject.com>
Subject:
Re: bounce handler does not recognize Content-Type: text/rfc822-headers
In-Reply-To:
Re: bounce handler does not recognize Content-Type: text/rfc822-headers
Date:
May 7th 2012
On May 7, 2012, at 10:35 AM, Frans Gouverne wrote:
> To fool the MIME parser, I added the following line in sub parse_bounce:
>
> #change text/rfc822-headers into message/rfc822
> $message =~ s|Content-Type: text/rfc822-headers|Content-Type: message/rfc822|g;
>
> eval { $entity = $parser->parse_data($message) }; > [etc]
>
> seems to be working...
This is what I tried:
https://gist.github.com/2631381
So, instead of hacking the message, I just made it look for that weird Content-Type and parse what's in the, "body" as if itself is an entity, even though it only holds the headers. Really strange. You'll see a few lines, like this:
if ( $entity->head->mime_type eq 'message/rfc822') {
$orig_msg_copy = $parts[0];
$list = $self->list_in_list_headers($orig_msg_copy);
}
elsif($entity->head->mime_type eq 'text/rfc822-headers'){
require MIME::Parser;
my $parser = new MIME::Parser;
$parser = optimize_mime_parser($parser);
eval {
$orig_msg_copy = $parser->parse_data( $entity->bodyhandle->as_string );
};
if ($@) {
warn "Trouble parsing text/rfc822-headers message. $@";
}
else {
}
$list = $self->list_in_list_headers($orig_msg_copy);
}
With that, if I then parse that message (I changed the list's shortname):
justin-4:plugins justin$ ./dada_bounce_handler.pl --test test.eml --list j --verbose Test #1: test.eml
Status: 5.2.2
Final-Recipient: rfc822; emailname@emaildomain.nl
Original-Recipient: rfc822;emailname@emaildomain.nl
X-Postfix-Sender: rfc822; 00000136e9c52c44-a7f91c97-0c21-436b-b714-4227adce6415-000000@amazonses.com
Action: failed
Simplified-Message-Id: 00000136e9c52c44-a7f91c97-0c21-436b-b714-4227adce6415-000000@email
Reporting-MTA: dns; mailscan12.emaildomain.nl
Bounce_To: bounces@mydomain.nu
Bounce_From: MAILER-DAEMON@amazonses.com
reason: input/output error
std_reason: unknown
host: emaildomain.nl
Arrival-Date: Wed, 25 Apr 2012 15
Message-Id: <00000136e9c52c44-a7f91c97-0c21-436b-b714-4227adce6415-000000@email.amazonses.com>
X-Postfix-Queue-ID: 18381174112
Diagnostic-Code: x-unix; input/output error
Bounce_Subject: Undelivered Mail Returned to Sender
You at least have something to work on (and make a new rule, for) - although, Dada Mail isn't looking at that first part of of the bounce:
This is the mail system at host mailscan12.emaildomain.nl.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<emailname@emaildomain.nl>: maildir delivery failed: error writing message: Disk
quota exceeded
Which sort of stinks.
|
<< Previous: another small modification to the bounce handler |
| Archive Index | |
Next: Re: another small modification to the bounce handler >> |
This mailing list is to discuss the nerdy programming development of Dada Mail -
If you are just looking for support Dada Mail, consult the message boards at:
http://dadamailproject.com/support/boards
To post to this list, send a message to:
All subscribers of this list may post to the list itself.
Some on topic... topics include:
At the moment, there aren't many people with CVS access for Dada Mail - if you would like CVS access, please first talk about the changes you propose and how it will affect the program. If the idea is sound and agreed upon, the change will be comitted. A good track record of this will allow you to have CVS access. Some reasons that patches will not be accepted is if the patch breaks compatibility with a previous version of the program, the patch is too centric to your own problem or the patch simply isn't very good.
Please, please please familiarize yourself with the documentation at:
http://dadamailproject.com/support/documentation/
Since no one wants to answer the same question twice.
Another sneaky reason for this mailing list is to test out the discussion list capabilities of Dada Mail, since Dada Mail is used for the mailing list itself.
NOTE - because of this, there may be times that this list will be somewhat broken. Although we're not planning on breaking the program by using it, we're giving you the heads up that this may well happen anyways.