How I Learned to Stop Worrying and Love Email::: The 2007 PEP Talk!!
-
Upload
ricardo-signes -
Category
Technology
-
view
5.578 -
download
1
description
Transcript of How I Learned to Stop Worrying and Love Email::: The 2007 PEP Talk!!
PerlEmail Project
the 2007 PEP talk!!!
How I Learned To Stop Worrying
andLove Email
we’re hiring: http://xrl.us/pobox
Perl Email Project
PEP
Email::
simpleefficientaccurate
less processor time
less memory
fewer classes
fewer methods
LESS OF A PAIN IN THE ASS
Make Email Handling Suck
Less
writing better modules
maintaining old modules
sharing knowledge
Modules!
Frameworks
Mail-Box
Email::
Message Objects
Email::Simple&
Email::MIME
use Email::Simple;
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create(
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’,
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’,
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’,
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => ‘1099’,
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’,
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ],
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ], body => “[ insert threatening text here ]”
use Email::Simple;
my $email = Email::Simple->new($string);
use Email::Simple::Creator;my $email = Email::Simple->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ], body => “[ insert threatening text here ]”);
$email->as_string;
$email->as_string;
$email->header(‘Subject’);
$email->as_string;
$email->header(‘Subject’);
$email->header_set(Subject => ‘Re: mtfnpy’);
$email->as_string;
$email->header(‘Subject’);
$email->header_set(Subject => ‘Re: mtfnpy’);
$email->body;
$email->as_string;
$email->header(‘Subject’);
$email->header_set(Subject => ‘Re: mtfnpy’);
$email->body;
$email->body_set($big_string);
use Email::Simple;
use Email::Simple;
my $email = Email::Simple->new( \$string );
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple::FromHandle;
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple::FromHandle;
my $email = Email::SimpleFromHandle->new(
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple::FromHandle;
my $email = Email::SimpleFromHandle->new( $input_handle
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple::FromHandle;
my $email = Email::SimpleFromHandle->new( $input_handle);
use Email::Simple;
my $email = Email::Simple->new( \$string );$email->body_set( \$new_body );
use Email::Simple::FromHandle;
my $email = Email::SimpleFromHandle->new( $input_handle);
$email->stream_to($output_handle);
my $email = Email::MIME->new(\$string);
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create(
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’,
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’,
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’,
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes =>
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
parts => [
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
parts => [ Email::MIME->create(...),
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
parts => [ Email::MIME->create(...), Email::MIME->create(...),
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
parts => [ Email::MIME->create(...), Email::MIME->create(...), ],
my $email = Email::MIME->new(\$string);
use Email::MIME::Creator;my $email = Email::MIME->create( header => [ To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ],
attributes => { content_type => ‘multipart/mixed’ },
parts => [ Email::MIME->create(...), Email::MIME->create(...), ],);
$email->subparts;
$email->subparts;
$email->parts_set(@parts);
$email->subparts;
$email->parts_set(@parts);
$email->body_raw;
problems
still not efficient enough
problems
still not efficient enough
FromHandle doesn’t do MIME
problems
still not efficient enough
FromHandle doesn’t do MIME
Email::MIME doesn’t stream
problems
still not efficient enough
FromHandle doesn’t do MIME
Email::MIME doesn’t stream
fairly small feature set*
problems
MIME::Entity
my $entity = MIME::Entity->new($input_handle);
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build(
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’,
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’,
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’,
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ],
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],);
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],);
$entity->attach(
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],);
$entity->attach( Path => ‘./reports/audit-results.pdf’,
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],);
$entity->attach( Path => ‘./reports/audit-results.pdf’, Type => ‘application/pdf’,
my $entity = MIME::Entity->new($input_handle);my $entity = MIME::Entity->new(\@lines);
my $entity = MIME::Entity->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],);
$entity->attach( Path => ‘./reports/audit-results.pdf’, Type => ‘application/pdf’,);
problems
really big (loads 50+ extra modules)
problems
really big (loads 50+ extra modules)
large, sometimes confusing interface
problems
really big (loads 50+ extra modules)
large, sometimes confusing interface
history of subtle bugs
problems
Mail::Message(a Mail::Box Production)
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build(
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.\n”,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.\n”, file => ‘./reports/audit-results.pdf’,
my $mail = Mail::Message->read($input_handle);
my $mail = Mail::Message->build( To => ‘[email protected]’, From => ‘IRS <[email protected]>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.\n”, file => ‘./reports/audit-results.pdf’,);
$mail->string;
$mail->string;
$mail->head->get(‘Subject’);
$mail->string;
$mail->head->get(‘Subject’);
$mail->head->delete(‘X-Pointles’);
$mail->string;
$mail->head->get(‘Subject’);
$mail->head->delete(‘X-Pointles’);
$mail->head->reset(Subject => “I’m on TV!”);
$mail->string;
$mail->head->get(‘Subject’);
$mail->head->delete(‘X-Pointles’);
$mail->head->reset(Subject => “I’m on TV!”);
$mail->body(
$mail->string;
$mail->head->get(‘Subject’);
$mail->head->delete(‘X-Pointles’);
$mail->head->reset(Subject => “I’m on TV!”);
$mail->body( Mail::Message::Body->new(data => $data),
$mail->string;
$mail->head->get(‘Subject’);
$mail->head->delete(‘X-Pointles’);
$mail->head->reset(Subject => “I’m on TV!”);
$mail->body( Mail::Message::Body->new(data => $data),);
$mail->body->parts;
$mail->body->parts;
$mail->body->attach(@things);
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
my @parts = $mail->body->parts(
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html }
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html });
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html });$_->delete for @parts;
$mail->body->parts;
$mail->body->attach(@things);$mail->body->part(1)->delete;
my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html });$_->delete for @parts;$mail->body->rebuild;
problems
really big (loads 40+ extra modules)
problems
really big (loads 40+ extra modules)
large, sometimes confusing interface
problems
Mail::Internet
Mail::Internet
MIME::Lite
MIME::Lite
Email::Abstract
my $abstract = Email::Abstract->new($thing);
my $abstract = Email::Abstract->new($thing);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;$abstract->set_body(‘This is a short body!’);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;$abstract->set_body(‘This is a short body!’);
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;$abstract->set_body(‘This is a short body!’);
$abstract->as_string;
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;$abstract->set_body(‘This is a short body!’);
$abstract->as_string;
my $abstract = Email::Abstract->new($thing);
$abstract->get_header(‘Subject’);$abstract->set_header(Subject => ‘Foo!’);
$abstract->get_body;$abstract->set_body(‘This is a short body!’);
$abstract->as_string;
$abstract->cast(‘Mail::Internet’);
Email::Simple & ::MIME
Email::Simple & ::MIME
MIME::Entity
Email::Simple & ::MIME
MIME::Entity
Mail::Internet
Email::Simple & ::MIME
MIME::Entity
Mail::Internet
Mail::Message
Email::Simple & ::MIME
MIME::Entity
Mail::Internet
Mail::Message
more coming
problems
missing some key methods
problems
missing some key methods
needs more testing for complex message types
problems
missing some key methods
needs more testing for complex message types
can be inefficient
problems
suggestion
suggestion
learn all of Email::Simple and most of Email::MIME
suggestion
learn all of Email::Simple and most of Email::MIME
for sending your own simple emails, use these
suggestion
learn the basics of Mail::Message
suggestion
learn the basics of Mail::Message
use it if you know you’ll need to use more of Mail::Box in the future
suggestion
learn the basics of Mail::Message
use it if you know you’ll need to use more of Mail::Box in the future
use it if you have complex encoding or MIME-handling requirements
suggestion
suggestion
learn the basics of handling MIME::Entity messages
suggestion
learn the basics of handling MIME::Entity messages
lots of code uses them
suggestion
learn the basics of handling MIME::Entity messages
lots of code uses them
use MIME::Entity when you need to cope with crappy input that nothing else can parse
suggestion
suggestion
suggestion
if you write an API that is passed an email message, consider using Abstract
suggestion
if you write an API that is passed an email message, consider using Abstract
if it exists primarily for handling email, pick a more complete library to use, and stick to it.
Email Collections
Mail::Box
my $maildir = Mail::Box::Maildir->new
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $newmsg = Mail::Message->new(...);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $newmsg = Mail::Message->new(...);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $newmsg = Mail::Message->new(...);
$maildir->addMessage($newmsg);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $newmsg = Mail::Message->new(...);
$maildir->addMessage($newmsg);
my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,);
my $message = $maildir->message(4);
$message->delete;
my $newmsg = Mail::Message->new(...);
$maildir->addMessage($newmsg);
$maildir->write;
folders over the net
subfolders
threading
delayed reading&
construction
suggestion
suggestion
if you need to manage mailboxes, just use it
suggestion
if you need to manage mailboxes, just use it
there isn’t really any alternative
suggestion
if you need to manage mailboxes, just use it
there isn’t really any alternative
unless you count...
Email::Folder(and friends)
a bunch of modules
Email::Feature::Type
Email::FolderType
use Email::FolderType qw(folder_type);
use Email::FolderType qw(folder_type);
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
my $type = folder_type(‘./Maildir/’);
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
my $type = folder_type(‘./Maildir/’);# => ‘Maildir’
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
my $type = folder_type(‘./Maildir/’);# => ‘Maildir’
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
my $type = folder_type(‘./Maildir/’);# => ‘Maildir’
my $type = folder_type(‘./Maildir//’);
use Email::FolderType qw(folder_type);
my $type = folder_type(‘./Maildir’);# => ‘Mbox’
my $type = folder_type(‘./Maildir/’);# => ‘Maildir’
my $type = folder_type(‘./Maildir//’);# => Ezmlm
Email::Folder
Email::Folder::Reader
my $reader = Email::Folder->new(“./Maildir/”);
my $reader = Email::Folder->new(“./Maildir/”);
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) {
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) { print “to delete!”
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) { print “to delete!” if $email->header(‘from’) =~ /Laura/i;
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) { print “to delete!” if $email->header(‘from’) =~ /Laura/i;}
Email::Delete
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) { $email->delete if $email->header(‘from’) =~ /Laura/i;}
my $reader = Email::Folder->new(“./Maildir/”);
while (my $email = $reader->next_message) { $email->delete if $email->header(‘from’) =~ /Laura/i;}
NOT REAL CODE
delete_message(
delete_message(from => “./Maildir/”,
delete_message(from => “./Maildir/”,matching => sub {
delete_message(from => “./Maildir/”,matching => sub { shift->header(‘message-id’)
delete_message(from => “./Maildir/”,matching => sub { shift->header(‘message-id’)
eq
delete_message(from => “./Maildir/”,matching => sub { shift->header(‘message-id’)
eq$email->header(‘message-id’)
delete_message(from => “./Maildir/”,matching => sub { shift->header(‘message-id’)
eq$email->header(‘message-id’)
},
delete_message(from => “./Maildir/”,matching => sub { shift->header(‘message-id’)
eq$email->header(‘message-id’)
},);
my $reader = Email::Folder->new(“./Maildir/”);
my $reader = Email::Folder->new(“./Maildir/”);
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message(
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift;
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
and
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
and! $saw_id{ $email->header(‘references’) }
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
and! $saw_id{ $email->header(‘references’) }
},
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
and! $saw_id{ $email->header(‘references’) }
},);
my $reader = Email::Folder->new(“./Maildir/”);
$saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
delete_message( from => “./Maildir”,
matching => sub { my $email = shift; $email->header(‘references’)
and! $saw_id{ $email->header(‘references’) }
},);
so, we can delete
(sort of)
how do we add?
Email::LocalDelivery
@successes = Email::LocalDelivery->deliver(
@successes = Email::LocalDelivery->deliver($string,
@successes = Email::LocalDelivery->deliver($string,‘./Maildir/’,
@successes = Email::LocalDelivery->deliver($string,‘./Maildir/’,‘/var/spool/mail/rjbs’,
@successes = Email::LocalDelivery->deliver($string,‘./Maildir/’,‘/var/spool/mail/rjbs’,‘imap://[email protected]/INBOX’,
@successes = Email::LocalDelivery->deliver($string,‘./Maildir/’,‘/var/spool/mail/rjbs’,‘imap://[email protected]/INBOX’,
);
@successes = Email::LocalDelivery->deliver($string,‘./Maildir/’,‘/var/spool/mail/rjbs’,‘imap://[email protected]/INBOX’,
);
can’t stream the message
must load it all into memory
and then copy it
problems
problems
the pieces don’t fit together
problems
the pieces don’t fit together
can be very inefficient
problems
the pieces don’t fit together
can be very inefficient
difficult to extend
suggestion
suggestion
fine for a quick one-off
suggestion
fine for a quick one-off
not ready for prime time
Net::Protocol
Net::IMAP::Simple
Net::IMAP
Mail::IMAPClient
Net::POP3
Mail::POP3Client
Sending Mail
Mail::Send
Mail::Mailer
my $mailer = Mail::Mailer->new(‘sendmail’);
my $mailer = Mail::Mailer->new(‘sendmail’);
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
print $mailer "Body of message";
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
print $mailer "Body of message";
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
print $mailer "Body of message";
$mailer->close;
my $mailer = Mail::Mailer->new(‘sendmail’);
$mailer->open({To => [ ‘boss@corp’, ‘boss2@corp’ ],Bcc => ‘the.ceo@corp’,Subject => ‘u sux’,
});
print $mailer "Body of message";
$mailer->close;# ...and it gets sent
Mail::Sender
my $sender = Mail::Sender->new({smtp => ‘smtp.haliburton.gov’,});
$sender->Open({ from => '[email protected]',
to => '[email protected]', subject => 'HTML test', ctype => "text/html", encoding => "7bit"}) or die $Mail::Sender::Error,"\n";
while (<$input>) {$sender->SendEx($_); # no encoding!};
$sender->Close();
Mail::Sendmail
use Mail::Sendmail;
sendmail( To => ‘[email protected]’, From => ‘[email protected]’, Subject => ‘STFU’, Body => $entire_message_body,) or die “sendmail: $Mail::Sendmail::error”;
Mail::Transport(a Mail::Box Production)
my $sender = Mail::Transport::SMTP->new(
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
$sender->send(
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
$sender->send($message,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
$sender->send($message,
from => $env_sender,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
$sender->send($message,
from => $env_sender, to => $env_rcpt,
my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘[email protected]’, password => ‘viagra’,);
$sender->send($message,
from => $env_sender, to => $env_rcpt,);
::Exim::Mailx::Qmail::SMTP::Sendmail
Email::Send
my $sender = Email::Send->new({
my $sender = Email::Send->new({ mailer => ‘SMTP’,
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’,
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’,
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’,
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $rv = $sender->send($email);
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $rv = $sender->send($email);
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $rv = $sender->send($email);
unless ($rv) {
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $rv = $sender->send($email);
unless ($rv) { die “failed to send: “ . $rv->string;
my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],});
my $rv = $sender->send($email);
unless ($rv) { die “failed to send: “ . $rv->string;}
problems
problems
Return::Value
problems
Return::Value
no envelope sender
problems
Return::Value
no envelope sender
awkward mailer/sender distinction
problems
Return::Value
no envelope sender
awkward mailer/sender distinction
difficult to extend api
problems
Return::Value
no envelope sender
awkward mailer/sender distinction
difficult to extend api
not enough API guaranteed for interchangeability
Email::Sender?
my $sender = Email::Sender::SMTP->new({
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send(
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email,
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email, {
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email, { to => $env_rcpt, # or \@env_rcpts
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email, { to => $env_rcpt, # or \@env_rcpts from => $env_sender,
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email, { to => $env_rcpt, # or \@env_rcpts from => $env_sender, }
my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
user => ‘rjbs’,pass => ‘wishiwereanoscarmeyerweiner’,
});
$sender->send( $email, { to => $env_rcpt, # or \@env_rcpts from => $env_sender, });
Email::Sender::Simple->send( $email, { to => $recipient, from => $sender, },);
Email::Sender::Simple->send( $email, { to => $recipient, from => $sender, },);
$ EMAIL_SENDER=SQLite ./your-program
Filtering Mail
Mail::Audit
my $mail = Mail::Audit->new;
my $mail = Mail::Audit->new;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’)
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
my $mail = Mail::Audit->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
$mail->accept;
Email::Filter
my $mail = Email::Filter->new;
my $mail = Email::Filter->new;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’)
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
my $mail = Email::Filter->new;
$mail->ignore if $mail->from_daemon;
$mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
$mail->reject if $mail->from =~ /laura/i;
$mail->accept;
key differences
key differences
Mail::Audit does more
key differences
Mail::Audit does more
Mail::Audit is > 4x the size
key differences
Mail::Audit does more
Mail::Audit is > 4x the size
Mail::Audit is totally insane
key differences
Mail::Audit does more
Mail::Audit is > 4x the size
Mail::Audit is totally insane
Mail::Audit is better tested
Mail::Procmail
Mail::Procmail
It’s like Mail::Audit
Mail::Procmail
It’s like Mail::Audit
but exports a bunch of subs
Mail::Procmail
It’s like Mail::Audit
but exports a bunch of subs
can be made into a E::F plugin
Mail::Procmail
It’s like Mail::Audit
but exports a bunch of subs
can be made into a E::F plugin
built-in logging
Mail::Sort
Mail::Sort
It’s like Mail::Audit
Mail::Sort
It’s like Mail::Audit
but has lots more methods
Mail::Sort
It’s like Mail::Audit
but has lots more methods
mostly for common matches
Mail::Sort
It’s like Mail::Audit
but has lots more methods
mostly for common matches
could be some E::F plugins
Email Addresses
HATE!!
Mail::Address
Email::Address
Mail::Address
Email::Address
Mail::Message::Field::
Address
Email::Validaddress is well-formed
domain name is valid
domain is fqdn in a tld
domain actually exists
some per-domain rules
some fudging allowed
Cool Stuff
Email::Stuff
Email::Stuff
Email::Stuff ->from('Principal Skinner <[email protected]>')
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]')
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”)
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”)
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”)
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach(
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’),
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’), filename => 'dead_bunbun_proof.gif')
Email::Stuff ->from('Principal Skinner <[email protected]>') ->to('[email protected]') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’), filename => 'dead_bunbun_proof.gif')
->send;
HTML Email(yeah, I know)
Email::MIME::CreateHTML
use Email::MIME::CreateHTML;
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’,
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’,
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,],
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,],body => $html,
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,],body => $html,
);
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,],body => $html,text_body => $text,
);
my $markdown = slurp(STDIN);
use Email::MIME::CreateHTML;my $email = Email::MIME->create_html(
header => [ to => ‘[email protected]’, from => ‘[email protected]’, subject => ‘Happy Birthday!’,],body => markdown($markdown),text_body => $markdown,
);
use Email::StripMIME qw(strip_mime);
my $stripped_email = Email::MIME->new( strip_mime($email->as_string));
Sifting Through MIME Parts
Email::MIME::XPath
use Email::MIME::XPath;
use Email::MIME::XPath;
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes(
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”);
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”);
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”);
my $address = $part->xpath_address;
use Email::MIME::XPath;
my ($part) = $email->xpath_findnodes(“//plain”);
my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”);
my $address = $part->xpath_address;die “error in part $address!”;
Sending Signed Mail
my $gpg = Mail::GPG->new(
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,;
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,;
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,;
my $signed_entity = $gpg->mime_sign(
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,;
my $signed_entity = $gpg->mime_sign( entity => $entity,
my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,;
my $signed_entity = $gpg->mime_sign( entity => $entity,);
Managing Your Mail
addressbook = App::Addex::AddressBook::Apple
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Mutt
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmail
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
[App::Addex::Output::SpamAssassin]
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
[App::Addex::Output::SpamAssassin]filename = spamassassin/whitelists-abook
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
[App::Addex::Output::SpamAssassin]filename = spamassassin/whitelists-abook
addressbook = App::Addex::AddressBook::Appleoutput = App::Addex::Output::Muttoutput = App::Addex::Output::Procmailoutput = App::Addex::Output::SpamAssassin
[App::Addex::Output::Mutt]filename = mutt/alias-abook
[App::Addex::Output::Procmail]filename = procmail/friends.rc
[App::Addex::Output::SpamAssassin]filename = spamassassin/whitelists-abook
alias mollymillions [email protected] (Molly Millions)alias mollymillions-home [email protected] (Molly Millions)alias mollymillions-work [email protected] (Molly Millions)alias mollymillions-work-1 [email protected] (Molly Millions)
alias mollymillions [email protected] (Molly Millions)alias mollymillions-home [email protected] (Molly Millions)alias mollymillions-work [email protected] (Molly Millions)alias mollymillions-work-1 [email protected] (Molly Millions)
mailboxes =friends.molly
alias mollymillions [email protected] (Molly Millions)alias mollymillions-home [email protected] (Molly Millions)alias mollymillions-work [email protected] (Molly Millions)alias mollymillions-work-1 [email protected] (Molly Millions)
mailboxes =friends.molly
save-hook [email protected] =friends.mollysave-hook [email protected] =friends.mollysave-hook [email protected] =friends.molly
alias mollymillions [email protected] (Molly Millions)alias mollymillions-home [email protected] (Molly Millions)alias mollymillions-work [email protected] (Molly Millions)alias mollymillions-work-1 [email protected] (Molly Millions)
send-hook [email protected] set signature="~/.sig/ninja"send-hook [email protected] set signature="~/.sig/ninja"send-hook [email protected] set signature="~/.sig/ninja"
mailboxes =friends.molly
save-hook [email protected] =friends.mollysave-hook [email protected] =friends.mollysave-hook [email protected] =friends.molly
:0* From:.*[email protected]/
:0* From:.*[email protected]/
:0* From:.*[email protected]/
whitelist_from [email protected]_from [email protected]_from [email protected]
The Future
Email::Corpus
Email::Corpus::Email
Email::Corpus::Addr
Email::KB::Headers
Metadata Plugin
Bounce Classifier
http://emailproject.perl.org/
ThankYou!