[Mimedefang] Exporting an eml file from MIMEDefang
Nigel Allen
dna at edrs.com.au
Wed Oct 13 20:56:31 EDT 2010
On 8/10/2010 02:31, David F. Skoll wrote:
> On 10/06/10 23:48, Nigel Allen wrote:
>
>> I need to export an entire email depending on some test results within
>> MIMEDefang-filter.
>
> The file INPUTMSG in the current working directory is an
> RFC 2822 (or RFC 5322)-formatted message. Copy it where you need it.
>
Given that my perl skills are only exceeded by my good looks, would
anyone be kind enough to peer check this snippet for me?
The rules I need to implement are:
If the header X-Strata-Plan does not begin with 988, copy the message to
the folder /tmp/oce_email.
The required file name format is:
"Mail_"
StrataNumber
"_11-Email_"
Email Subject (max 64 characters)
".eml"
Example: Mail_152_11-Email_FW Research is fun after all.emlThe file
name should be
undef($spno);
$spno = $entity->head->get("X-Strata-Plan");
if (defined($spno)) {
$copy_to = 'plans at mycompany.com.au';
add_recipient($copy_to);
$subject = $entity->head->get("Subject");
chop($spno);
chop($subject);
$subject = substr $subject, 0, 64);
if (!($spno =~ m/^988/)) {
$dest = '/tmp/oce_email/Mail_' . $spno . '_11-Email_' .
$subject . '.eml';
use File::Copy;
copy(INPUTMSG, $dest);
}
}
Thanks and Regards
Nigel.
More information about the MIMEDefang
mailing list