Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How I Learned to Stop Worrying and Love Email::: The 2007 PEP Talk!!

6,349 views

Published on

Ready? 250 OK! Everybody loves email, right? Right! What better language than Perl for handling all your email needs? None, right? Right! After all, with about nine hundred email modules on the CPAN, the only question is: which tool is right for the job?

This year, the Perl Email Project is going to tell you what's what. We'll see what modules solve what problems, how they differ, and how they (may or my not) work together.

We'll also show what problems aren't well-solved, what is in the works to make it happen, and how you can help.

Published in: Technology, Business
  • Be the first to comment

How I Learned to Stop Worrying and Love Email::: The 2007 PEP Talk!!

  1. 1. Perl Email Project the 2007 PEP talk!!!
  2. 2. How I Learned To Stop Worrying and Love Email
  3. 3. rjbs @cpan.org
  4. 4. we’re hiring: http://xrl.us/pobox
  5. 5. Perl Email Project
  6. 6. PEP
  7. 7. Email::
  8. 8. simple efficient accurate
  9. 9. less processor time
  10. 10. less memory
  11. 11. fewer classes
  12. 12. fewer methods
  13. 13. LESS OF A PAIN IN THE ASS
  14. 14. Make Email Handling Suck Less
  15. 15. writing better modules
  16. 16. maintaining old modules
  17. 17. sharing knowledge
  18. 18. Modules!
  19. 19. Frameworks
  20. 20. Mail-Box
  21. 21. Email::
  22. 22. Message Objects
  23. 23. Email::Simple & Email::MIME
  24. 24. use Email::Simple;
  25. 25. use Email::Simple; my $email = Email::Simple->new($string);
  26. 26. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator;
  27. 27. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create(
  28. 28. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [
  29. 29. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’,
  30. 30. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’,
  31. 31. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’,
  32. 32. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => ‘1099’,
  33. 33. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’,
  34. 34. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ],
  35. 35. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ], body => “[ insert threatening text here ]”
  36. 36. use Email::Simple; my $email = Email::Simple->new($string); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => ‘1099’, Keyword => ‘1040’, ], body => “[ insert threatening text here ]” );
  37. 37. $email->as_string;
  38. 38. $email->as_string; $email->header(‘Subject’);
  39. 39. $email->as_string; $email->header(‘Subject’); $email->header_set(Subject => ‘Re: mtfnpy’);
  40. 40. $email->as_string; $email->header(‘Subject’); $email->header_set(Subject => ‘Re: mtfnpy’); $email->body;
  41. 41. $email->as_string; $email->header(‘Subject’); $email->header_set(Subject => ‘Re: mtfnpy’); $email->body; $email->body_set($big_string);
  42. 42. use Email::Simple;
  43. 43. use Email::Simple; my $email = Email::Simple->new( $string );
  44. 44. use Email::Simple; my $email = Email::Simple->new( $string ); $email->body_set( $new_body );
  45. 45. use Email::Simple; my $email = Email::Simple->new( $string ); $email->body_set( $new_body ); use Email::Simple::FromHandle;
  46. 46. use Email::Simple; my $email = Email::Simple->new( $string ); $email->body_set( $new_body ); use Email::Simple::FromHandle; my $email = Email::SimpleFromHandle->new(
  47. 47. 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
  48. 48. 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 );
  49. 49. 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);
  50. 50. my $email = Email::MIME->new($string);
  51. 51. my $email = Email::MIME->new($string); use Email::MIME::Creator;
  52. 52. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create(
  53. 53. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [
  54. 54. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’,
  55. 55. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’,
  56. 56. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’,
  57. 57. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ],
  58. 58. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes =>
  59. 59. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ },
  60. 60. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ }, parts => [
  61. 61. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ }, parts => [ Email::MIME->create(...),
  62. 62. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ }, parts => [ Email::MIME->create(...), Email::MIME->create(...),
  63. 63. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ }, parts => [ Email::MIME->create(...), Email::MIME->create(...), ],
  64. 64. my $email = Email::MIME->new($string); use Email::MIME::Creator; my $email = Email::MIME->create( header => [ To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ], attributes => { content_type => ‘multipart/mixed’ }, parts => [ Email::MIME->create(...), Email::MIME->create(...), ], );
  65. 65. $email->subparts;
  66. 66. $email->subparts; $email->parts_set(@parts);
  67. 67. $email->subparts; $email->parts_set(@parts); $email->body_raw;
  68. 68. problems
  69. 69. problems still not efficient enough
  70. 70. problems still not efficient enough FromHandle doesn’t do MIME
  71. 71. problems still not efficient enough FromHandle doesn’t do MIME Email::MIME doesn’t stream
  72. 72. problems still not efficient enough FromHandle doesn’t do MIME Email::MIME doesn’t stream fairly small feature set*
  73. 73. MIME::Entity
  74. 74. my $entity = MIME::Entity->new($input_handle);
  75. 75. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines);
  76. 76. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build(
  77. 77. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’,
  78. 78. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’,
  79. 79. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’,
  80. 80. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ],
  81. 81. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ],
  82. 82. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ], );
  83. 83. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ], ); $entity->attach(
  84. 84. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ], ); $entity->attach( Path => ‘./reports/audit-results.pdf’,
  85. 85. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ], ); $entity->attach( Path => ‘./reports/audit-results.pdf’, Type => ‘application/pdf’,
  86. 86. my $entity = MIME::Entity->new($input_handle); my $entity = MIME::Entity->new(@lines); my $entity = MIME::Entity->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, ‘Keyword:’ => [ 1099, 1040 ], Data => [ “This might be an audit.” ], ); $entity->attach( Path => ‘./reports/audit-results.pdf’, Type => ‘application/pdf’, );
  87. 87. problems
  88. 88. problems really big (loads 50+ extra modules)
  89. 89. problems really big (loads 50+ extra modules) large, sometimes confusing interface
  90. 90. problems really big (loads 50+ extra modules) large, sometimes confusing interface history of subtle bugs
  91. 91. Mail::Message (a Mail::Box Production)
  92. 92. my $mail = Mail::Message->read($input_handle);
  93. 93. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build(
  94. 94. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’,
  95. 95. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’,
  96. 96. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’,
  97. 97. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099,
  98. 98. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040,
  99. 99. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040,
  100. 100. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.n”,
  101. 101. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.n”, file => ‘./reports/audit-results.pdf’,
  102. 102. my $mail = Mail::Message->read($input_handle); my $mail = Mail::Message->build( To => ‘rjbs@cpan.org’, From => ‘IRS <the.man@irs.gov>’, Subject => ‘Please See Me’, Keyword => 1099, Keyword => 1040, data => “This might be an audit.n”, file => ‘./reports/audit-results.pdf’, );
  103. 103. $mail->string;
  104. 104. $mail->string; $mail->head->get(‘Subject’);
  105. 105. $mail->string; $mail->head->get(‘Subject’); $mail->head->delete(‘X-Pointles’);
  106. 106. $mail->string; $mail->head->get(‘Subject’); $mail->head->delete(‘X-Pointles’); $mail->head->reset(Subject => “I’m on TV!”);
  107. 107. $mail->string; $mail->head->get(‘Subject’); $mail->head->delete(‘X-Pointles’); $mail->head->reset(Subject => “I’m on TV!”); $mail->body(
  108. 108. $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),
  109. 109. $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), );
  110. 110. $mail->body->parts;
  111. 111. $mail->body->parts; $mail->body->attach(@things);
  112. 112. $mail->body->parts; $mail->body->attach(@things); $mail->body->part(1)->delete;
  113. 113. $mail->body->parts; $mail->body->attach(@things); $mail->body->part(1)->delete; my @parts = $mail->body->parts(
  114. 114. $mail->body->parts; $mail->body->attach(@things); $mail->body->part(1)->delete; my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html }
  115. 115. $mail->body->parts; $mail->body->attach(@things); $mail->body->part(1)->delete; my @parts = $mail->body->parts( sub { $_[0]->mimeType eq ‘text/html } );
  116. 116. $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;
  117. 117. $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;
  118. 118. problems
  119. 119. problems really big (loads 40+ extra modules)
  120. 120. problems really big (loads 40+ extra modules) large, sometimes confusing interface
  121. 121. Mail::Internet
  122. 122. Mail::Internet
  123. 123. MIME::Lite
  124. 124. MIME::Lite
  125. 125. Email::Abstract
  126. 126. my $abstract = Email::Abstract->new($thing);
  127. 127. my $abstract = Email::Abstract->new($thing);
  128. 128. my $abstract = Email::Abstract->new($thing); $abstract->get_header(‘Subject’);
  129. 129. my $abstract = Email::Abstract->new($thing); $abstract->get_header(‘Subject’); $abstract->set_header(Subject => ‘Foo!’);
  130. 130. my $abstract = Email::Abstract->new($thing); $abstract->get_header(‘Subject’); $abstract->set_header(Subject => ‘Foo!’);
  131. 131. my $abstract = Email::Abstract->new($thing); $abstract->get_header(‘Subject’); $abstract->set_header(Subject => ‘Foo!’); $abstract->get_body;
  132. 132. 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!’);
  133. 133. 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!’);
  134. 134. 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;
  135. 135. 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;
  136. 136. 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’);
  137. 137. Email::Simple & ::MIME
  138. 138. Email::Simple & ::MIME MIME::Entity
  139. 139. Email::Simple & ::MIME MIME::Entity Mail::Internet
  140. 140. Email::Simple & ::MIME MIME::Entity Mail::Internet Mail::Message
  141. 141. Email::Simple & ::MIME MIME::Entity Mail::Internet Mail::Message more coming
  142. 142. problems
  143. 143. problems missing some key methods
  144. 144. problems missing some key methods needs more testing for complex message types
  145. 145. problems missing some key methods needs more testing for complex message types can be inefficient
  146. 146. suggestion
  147. 147. suggestion learn all of Email::Simple and most of Email::MIME
  148. 148. suggestion learn all of Email::Simple and most of Email::MIME for sending your own simple emails, use these
  149. 149. suggestion
  150. 150. suggestion learn the basics of Mail::Message
  151. 151. suggestion learn the basics of Mail::Message use it if you know you’ll need to use more of Mail::Box in the future
  152. 152. 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
  153. 153. suggestion
  154. 154. suggestion learn the basics of handling MIME::Entity messages
  155. 155. suggestion learn the basics of handling MIME::Entity messages lots of code uses them
  156. 156. 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
  157. 157. suggestion
  158. 158. suggestion if you write an API that is passed an email message, consider using Abstract
  159. 159. 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.
  160. 160. Email Collections
  161. 161. Mail::Box
  162. 162. my $maildir = Mail::Box::Maildir->new
  163. 163. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’,
  164. 164. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, );
  165. 165. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, );
  166. 166. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4);
  167. 167. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4);
  168. 168. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete;
  169. 169. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete;
  170. 170. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete; my $newmsg = Mail::Message->new(...);
  171. 171. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete; my $newmsg = Mail::Message->new(...);
  172. 172. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete; my $newmsg = Mail::Message->new(...); $maildir->addMessage($newmsg);
  173. 173. my $maildir = Mail::Box::Maildir->new folder => ‘./Maildir/’, ); my $message = $maildir->message(4); $message->delete; my $newmsg = Mail::Message->new(...); $maildir->addMessage($newmsg);
  174. 174. 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;
  175. 175. folders over the net
  176. 176. subfolders
  177. 177. threading
  178. 178. delayed reading & construction
  179. 179. suggestion
  180. 180. suggestion if you need to manage mailboxes, just use it
  181. 181. suggestion if you need to manage mailboxes, just use it there isn’t really any alternative
  182. 182. suggestion if you need to manage mailboxes, just use it there isn’t really any alternative unless you count...
  183. 183. Email::Folder (and friends)
  184. 184. a bunch of modules
  185. 185. Email::Feature::Type
  186. 186. Email::FolderType
  187. 187. use Email::FolderType qw(folder_type);
  188. 188. use Email::FolderType qw(folder_type);
  189. 189. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’);
  190. 190. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’
  191. 191. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’
  192. 192. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’ my $type = folder_type(‘./Maildir/’);
  193. 193. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’ my $type = folder_type(‘./Maildir/’); # => ‘Maildir’
  194. 194. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’ my $type = folder_type(‘./Maildir/’); # => ‘Maildir’
  195. 195. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’ my $type = folder_type(‘./Maildir/’); # => ‘Maildir’ my $type = folder_type(‘./Maildir//’);
  196. 196. use Email::FolderType qw(folder_type); my $type = folder_type(‘./Maildir’); # => ‘Mbox’ my $type = folder_type(‘./Maildir/’); # => ‘Maildir’ my $type = folder_type(‘./Maildir//’); # => Ezmlm
  197. 197. Email::Folder
  198. 198. Email::Folder::Reader
  199. 199. my $reader = Email::Folder->new(“./Maildir/”);
  200. 200. my $reader = Email::Folder->new(“./Maildir/”);
  201. 201. my $reader = Email::Folder->new(“./Maildir/”); while (my $email = $reader->next_message) {
  202. 202. my $reader = Email::Folder->new(“./Maildir/”); while (my $email = $reader->next_message) { print “to delete!”
  203. 203. my $reader = Email::Folder->new(“./Maildir/”); while (my $email = $reader->next_message) { print “to delete!” if $email->header(‘from’) =~ /Laura/i;
  204. 204. my $reader = Email::Folder->new(“./Maildir/”); while (my $email = $reader->next_message) { print “to delete!” if $email->header(‘from’) =~ /Laura/i; }
  205. 205. Email::Delete
  206. 206. my $reader = Email::Folder->new(“./Maildir/”); while (my $email = $reader->next_message) { $email->delete if $email->header(‘from’) =~ /Laura/i; }
  207. 207. E D O C my $reader = Email::Folder->new(“./Maildir/”); L A while (my $email = $reader->next_message) { E R $email->delete T if $email->header(‘from’) =~ /Laura/i; O } N
  208. 208. delete_message(
  209. 209. delete_message( from => “./Maildir/”,
  210. 210. delete_message( from => “./Maildir/”, matching => sub {
  211. 211. delete_message( from => “./Maildir/”, matching => sub { shift->header(‘message-id’)
  212. 212. delete_message( from => “./Maildir/”, matching => sub { shift->header(‘message-id’) eq
  213. 213. delete_message( from => “./Maildir/”, matching => sub { shift->header(‘message-id’) eq $email->header(‘message-id’)
  214. 214. delete_message( from => “./Maildir/”, matching => sub { shift->header(‘message-id’) eq $email->header(‘message-id’) },
  215. 215. delete_message( from => “./Maildir/”, matching => sub { shift->header(‘message-id’) eq $email->header(‘message-id’) }, );
  216. 216. my $reader = Email::Folder->new(“./Maildir/”);
  217. 217. my $reader = Email::Folder->new(“./Maildir/”);
  218. 218. my $reader = Email::Folder->new(“./Maildir/”); $saw_id{ $_->header(‘message-id’) } = 1
  219. 219. my $reader = Email::Folder->new(“./Maildir/”); $saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
  220. 220. my $reader = Email::Folder->new(“./Maildir/”); $saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message;
  221. 221. my $reader = Email::Folder->new(“./Maildir/”); $saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message; delete_message(
  222. 222. my $reader = Email::Folder->new(“./Maildir/”); $saw_id{ $_->header(‘message-id’) } = 1 while my $_ = $reader->next_message; delete_message( from => “./Maildir”,
  223. 223. 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;
  224. 224. 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’)
  225. 225. 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
  226. 226. 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’) }
  227. 227. 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’) } },
  228. 228. 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’) } }, );
  229. 229. 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’) } }, );
  230. 230. so, we can delete
  231. 231. (sort of)
  232. 232. how do we add?
  233. 233. Email::LocalDelivery
  234. 234. @successes = Email::LocalDelivery->deliver(
  235. 235. @successes = Email::LocalDelivery->deliver( $string,
  236. 236. @successes = Email::LocalDelivery->deliver( $string, ‘./Maildir/’,
  237. 237. @successes = Email::LocalDelivery->deliver( $string, ‘./Maildir/’, ‘/var/spool/mail/rjbs’,
  238. 238. @successes = Email::LocalDelivery->deliver( $string, ‘./Maildir/’, ‘/var/spool/mail/rjbs’, ‘imap://rjbs@mailstore.pobox.com/INBOX’,
  239. 239. @successes = Email::LocalDelivery->deliver( $string, ‘./Maildir/’, ‘/var/spool/mail/rjbs’, ‘imap://rjbs@mailstore.pobox.com/INBOX’, );
  240. 240. @successes = Email::LocalDelivery->deliver( $string, ‘./Maildir/’, ‘/var/spool/mail/rjbs’, ‘imap://rjbs@mailstore.pobox.com/INBOX’, );
  241. 241. can’t stream the message must load it all into memory and then copy it
  242. 242. problems
  243. 243. problems the pieces don’t fit together
  244. 244. problems the pieces don’t fit together can be very inefficient
  245. 245. problems the pieces don’t fit together can be very inefficient difficult to extend
  246. 246. suggestion
  247. 247. suggestion fine for a quick one-off
  248. 248. suggestion fine for a quick one-off not ready for prime time
  249. 249. Net::Protocol
  250. 250. Mail::POP3Client Net::POP3 Net::IMAP Net::IMAP::Simple Mail::IMAPClient
  251. 251. Sending Mail
  252. 252. Mail::Send
  253. 253. Mail::Mailer
  254. 254. my $mailer = Mail::Mailer->new(‘sendmail’);
  255. 255. my $mailer = Mail::Mailer->new(‘sendmail’);
  256. 256. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({
  257. 257. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ],
  258. 258. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’,
  259. 259. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’,
  260. 260. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, });
  261. 261. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, });
  262. 262. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, }); print $mailer quot;Body of messagequot;;
  263. 263. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, }); print $mailer quot;Body of messagequot;;
  264. 264. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, }); print $mailer quot;Body of messagequot;; $mailer->close;
  265. 265. my $mailer = Mail::Mailer->new(‘sendmail’); $mailer->open({ To => [ ‘boss@corp’, ‘boss2@corp’ ], Bcc => ‘the.ceo@corp’, Subject => ‘u sux’, }); print $mailer quot;Body of messagequot;; $mailer->close; # ...and it gets sent
  266. 266. Mail::Sender
  267. 267. my $sender = Mail::Sender->new({ smtp => ‘smtp.haliburton.gov’, }); $sender->Open({ from => 'your@address.com', to => 'other@address.com', subject => 'HTML test', ctype => quot;text/htmlquot;, encoding => quot;7bitquot; }) or die $Mail::Sender::Error,quot;nquot;; while (<$input>) { $sender->SendEx($_); # no encoding! }; $sender->Close();
  268. 268. Mail::Sendmail
  269. 269. use Mail::Sendmail; sendmail( To => ‘guy@2nd.row.org’, From => ‘rjbs@cpan.org’, Subject => ‘STFU’, Body => $entire_message_body, ) or die “sendmail: $Mail::Sendmail::error”;
  270. 270. Mail::Transport (a Mail::Box Production)
  271. 271. my $sender = Mail::Transport::SMTP->new(
  272. 272. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’,
  273. 273. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’,
  274. 274. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’,
  275. 275. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, );
  276. 276. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, );
  277. 277. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, ); $sender->send(
  278. 278. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, ); $sender->send( $message,
  279. 279. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, ); $sender->send( $message, from => $env_sender,
  280. 280. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, ); $sender->send( $message, from => $env_sender, to => $env_rcpt,
  281. 281. my $sender = Mail::Transport::SMTP->new( hostname => ‘nebu.fleet.zion.gov’, username => ‘t.anderson@yahoo.com’, password => ‘viagra’, ); $sender->send( $message, from => $env_sender, to => $env_rcpt, );
  282. 282. ::Exim ::Mailx ::Qmail ::SMTP ::Sendmail
  283. 283. Email::Send
  284. 284. my $sender = Email::Send->new({
  285. 285. my $sender = Email::Send->new({ mailer => ‘SMTP’,
  286. 286. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [
  287. 287. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’,
  288. 288. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’,
  289. 289. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’,
  290. 290. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ],
  291. 291. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ], });
  292. 292. my $sender = Email::Send->new({ mailer => ‘SMTP’, mailer_args => [ Host => ‘sir-mx-a-lot.plusplus.com’, username => ‘rjbs’, password => ‘g0t b4ckUPS’, ], });
  293. 293. 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);
  294. 294. 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);
  295. 295. 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) {
  296. 296. 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;
  297. 297. 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; }
  298. 298. problems
  299. 299. problems Return::Value
  300. 300. problems Return::Value no envelope sender
  301. 301. problems Return::Value no envelope sender awkward mailer/sender distinction
  302. 302. problems Return::Value no envelope sender awkward mailer/sender distinction difficult to extend api
  303. 303. problems Return::Value no envelope sender awkward mailer/sender distinction difficult to extend api not enough API guaranteed for interchangeability
  304. 304. Email::Sender?
  305. 305. my $sender = Email::Sender::SMTP->new({
  306. 306. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’,
  307. 307. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’,
  308. 308. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’,
  309. 309. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’, });
  310. 310. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’, });
  311. 311. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’, }); $sender->send(
  312. 312. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’, }); $sender->send( $email,
  313. 313. my $sender = Email::Sender::SMTP->new({ host => ‘sir-mx-a-lot.plusplus.com’, user => ‘rjbs’, pass => ‘wishiwereanoscarmeyerweiner’, }); $sender->send( $email, {
  314. 314. 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
  315. 315. 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,
  316. 316. 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, }
  317. 317. 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, } );
  318. 318. Email::Sender::Simple->send( $email, { to => $recipient, from => $sender, }, );
  319. 319. Email::Sender::Simple->send( $email, { to => $recipient, from => $sender, }, ); $ EMAIL_SENDER=SQLite ./your-program
  320. 320. Filtering Mail
  321. 321. Mail::Audit
  322. 322. my $mail = Mail::Audit->new;
  323. 323. my $mail = Mail::Audit->new;
  324. 324. my $mail = Mail::Audit->new; $mail->ignore if $mail->from_daemon;
  325. 325. my $mail = Mail::Audit->new; $mail->ignore if $mail->from_daemon;
  326. 326. my $mail = Mail::Audit->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’)
  327. 327. my $mail = Mail::Audit->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
  328. 328. my $mail = Mail::Audit->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
  329. 329. 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;
  330. 330. 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;
  331. 331. 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;
  332. 332. Email::Filter
  333. 333. my $mail = Email::Filter->new;
  334. 334. my $mail = Email::Filter->new;
  335. 335. my $mail = Email::Filter->new; $mail->ignore if $mail->from_daemon;
  336. 336. my $mail = Email::Filter->new; $mail->ignore if $mail->from_daemon;
  337. 337. my $mail = Email::Filter->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’)
  338. 338. my $mail = Email::Filter->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
  339. 339. my $mail = Email::Filter->new; $mail->ignore if $mail->from_daemon; $mail->accept(‘apologies’) if $mail->subject =~ /sorry/i;
  340. 340. 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;
  341. 341. 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;
  342. 342. 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;
  343. 343. key differences
  344. 344. key differences Mail::Audit does more
  345. 345. key differences Mail::Audit does more Mail::Audit is > 4x the size
  346. 346. key differences Mail::Audit does more Mail::Audit is > 4x the size Mail::Audit is totally insane
  347. 347. key differences Mail::Audit does more Mail::Audit is > 4x the size Mail::Audit is totally insane Mail::Audit is better tested
  348. 348. Mail::Procmail
  349. 349. Mail::Procmail It’s like Mail::Audit
  350. 350. Mail::Procmail It’s like Mail::Audit but exports a bunch of subs
  351. 351. Mail::Procmail It’s like Mail::Audit but exports a bunch of subs can be made into a E::F plugin
  352. 352. Mail::Procmail It’s like Mail::Audit but exports a bunch of subs can be made into a E::F plugin built-in logging
  353. 353. Mail::Sort
  354. 354. Mail::Sort It’s like Mail::Audit
  355. 355. Mail::Sort It’s like Mail::Audit but has lots more methods
  356. 356. Mail::Sort It’s like Mail::Audit but has lots more methods mostly for common matches
  357. 357. Mail::Sort It’s like Mail::Audit but has lots more methods mostly for common matches could be some E::F plugins
  358. 358. Email Addresses
  359. 359. HATE!!
  360. 360. Mail::Address Email::Address
  361. 361. Mail::Address Email::Address
  362. 362. Mail::Message ::Field:: Address
  363. 363. Email::Valid address is well-formed domain actually exists domain name is valid some per-domain rules domain is fqdn in a tld some fudging allowed
  364. 364. Cool Stuff
  365. 365. Email::Stuff
  366. 366. Email::Stuff
  367. 367. Email::Stuff ->from('Principal Skinner <seymore@se.edu>')
  368. 368. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org')
  369. 369. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”)
  370. 370. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”)
  371. 371. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”)
  372. 372. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach(
  373. 373. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’),
  374. 374. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’), filename => 'dead_bunbun_proof.gif')
  375. 375. Email::Stuff ->from('Principal Skinner <seymore@se.edu>') ->to('rjbs@cpan.org') ->text_body(“Please see me after class.”) ->header(Keywords => “trouble”) ->header(Keywords => “deep”) ->attach( slurp(‘1099.pdf’), filename => 'dead_bunbun_proof.gif') ->send;
  376. 376. HTML Email (yeah, I know)
  377. 377. Email::MIME ::CreateHTML
  378. 378. use Email::MIME::CreateHTML;
  379. 379. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html(
  380. 380. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [
  381. 381. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’,
  382. 382. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’,
  383. 383. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’,
  384. 384. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’, ],
  385. 385. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’, ], body => $html,
  386. 386. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’, ], body => $html, );
  387. 387. use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’, ], body => $html, text_body => $text, );
  388. 388. my $markdown = slurp(STDIN); use Email::MIME::CreateHTML; my $email = Email::MIME->create_html( header => [ to => ‘mom@aol.com’, from => ‘rjbs@cpan.org’, subject => ‘Happy Birthday!’, ], body => markdown($markdown), text_body => $markdown, );
  389. 389. use Email::StripMIME qw(strip_mime); my $stripped_email = Email::MIME->new( strip_mime($email->as_string) );
  390. 390. Sifting Through MIME Parts
  391. 391. Email::MIME::XPath
  392. 392. use Email::MIME::XPath;
  393. 393. use Email::MIME::XPath;
  394. 394. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”);
  395. 395. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”);
  396. 396. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”); my @images = $email->xpath_findnodes(
  397. 397. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”); my @images = $email->xpath_findnodes( “//png|//jpeg|//gif”
  398. 398. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”); my @images = $email->xpath_findnodes( “//png|//jpeg|//gif” );
  399. 399. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”); my @images = $email->xpath_findnodes( “//png|//jpeg|//gif” );
  400. 400. use Email::MIME::XPath; my ($part) = $email->xpath_findnodes(“//plain”); my @images = $email->xpath_findnodes( “//png|//jpeg|//gif” ); my $address = $part->xpath_address;
  401. 401. 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!”;
  402. 402. Sending Signed Mail
  403. 403. my $gpg = Mail::GPG->new(
  404. 404. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’,
  405. 405. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’, ;
  406. 406. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’, ;
  407. 407. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’, ; my $signed_entity = $gpg->mime_sign(
  408. 408. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’, ; my $signed_entity = $gpg->mime_sign( entity => $entity,
  409. 409. my $gpg = Mail::GPG->new( default_key_id => ‘12345678’, ; my $signed_entity = $gpg->mime_sign( entity => $entity, );
  410. 410. Managing Your Mail
  411. 411. addressbook = App::Addex::AddressBook::Apple
  412. 412. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt
  413. 413. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail
  414. 414. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin
  415. 415. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin
  416. 416. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt]
  417. 417. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook
  418. 418. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook
  419. 419. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook [App::Addex::Output::Procmail]
  420. 420. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook [App::Addex::Output::Procmail] filename = procmail/friends.rc
  421. 421. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook [App::Addex::Output::Procmail] filename = procmail/friends.rc
  422. 422. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = App::Addex::Output::SpamAssassin [App::Addex::Output::Mutt] filename = mutt/alias-abook [App::Addex::Output::Procmail] filename = procmail/friends.rc [App::Addex::Output::SpamAssassin]
  423. 423. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = 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
  424. 424. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = 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
  425. 425. addressbook = App::Addex::AddressBook::Apple output = App::Addex::Output::Mutt output = App::Addex::Output::Procmail output = 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
  426. 426. alias mollymillions molly@bama-online.com (Molly Millions) alias mollymillions-home molly@bama-online.com (Molly Millions) alias mollymillions-work mm@solo.com (Molly Millions) alias mollymillions-work-1 s.shears@bodymiraculous.com (Molly Millions)
  427. 427. alias mollymillions molly@bama-online.com (Molly Millions) alias mollymillions-home molly@bama-online.com (Molly Millions) alias mollymillions-work mm@solo.com (Molly Millions) alias mollymillions-work-1 s.shears@bodymiraculous.com (Molly Millions) mailboxes =friends.molly
  428. 428. alias mollymillions molly@bama-online.com (Molly Millions) alias mollymillions-home molly@bama-online.com (Molly Millions) alias mollymillions-work mm@solo.com (Molly Millions) alias mollymillions-work-1 s.shears@bodymiraculous.com (Molly Millions) mailboxes =friends.molly save-hook ~fmolly@bama-online.com =friends.molly save-hook ~fmm@solo.com =friends.molly save-hook ~fs.shears@bodymiraculous.com =friends.molly
  429. 429. alias mollymillions molly@bama-online.com (Molly Millions) alias mollymillions-home molly@bama-online.com (Molly Millions) alias mollymillions-work mm@solo.com (Molly Millions) alias mollymillions-work-1 s.shears@bodymiraculous.com (Molly Millions) mailboxes =friends.molly save-hook ~fmolly@bama-online.com =friends.molly save-hook ~fmm@solo.com =friends.molly save-hook ~fs.shears@bodymiraculous.com =friends.molly send-hook ~tmolly@bama-online.com set signature=quot;~/.sig/ninjaquot; send-hook ~tmm@solo.com set signature=quot;~/.sig/ninjaquot; send-hook ~ts.shears@bodymiraculous.com set signature=quot;~/.sig/ ninjaquot;
  430. 430. :0 * From:.*molly@bama-online.com .friends.molly/ :0 * From:.*mm@solo.com .friends.molly/ :0 * From:.*s.shears@bodymiraculous.com .friends.molly/
  431. 431. :0 * From:.*molly@bama-online.com .friends.molly/ :0 * From:.*mm@solo.com .friends.molly/ :0 * From:.*s.shears@bodymiraculous.com .friends.molly/ whitelist_from molly@bama-online.com whitelist_from mm@solo.com whitelist_from s.shears@bodymiraculous.com
  432. 432. The Future
  433. 433. Email::Corpus
  434. 434. Email::Corpus::Email
  435. 435. Email::Corpus::Addr
  436. 436. Email::KB::Headers
  437. 437. Metadata Plugin
  438. 438. Bounce Classifier
  439. 439. pep@perl.org http://emailproject.perl.org/
  440. 440. Thank You!

×