Upgrade to Pro — share decks privately, control downloads, hide ads and more …

rjbs <3 email

rjbs <3 email

Ok, email is a horrible technology with impossible technical specifications, implementations that are broken in seriously incompatible ways, and massive security issues that have led to a 9:1 noise to signal ratio. It stinks and makes me want to kill.

...but who am I kidding? I love email. It presents fun challenges, and along with the web is the internet medium most used by users of all types, each with their own needs.

This talk will review a few new Email:: modules developed in the last year and suitable for anybody who has to do stuff with email. Among these are Email::Sender, Email::MIME::Kit, and Email::ARF.

Ricardo Signes

June 23, 2009
Tweet

More Decks by Ricardo Signes

Other Decks in Programming

Transcript

  1. Existing Solutions none? horrible hacks make a template in TT

    render to html html-to-text hope you guess right at headers
  2. Kit Manifest { "renderer" : "TT", "header" : [ {

    "Subject": "Hello [% user.name %]" }, { "From": "Test Sender <[email protected]>" }, { "To": "[% user.email %]" } ], "alternatives": [ { "type": "text/plain", "path": "body.txt" }, { "type": "text/html", "path": "body.html" } ], "attachments": [ { "path": "demands.rtf" } ] }
  3. Assembling the Kit my $kit = Email::MIME::Kit->new({ source => ‘msg.mkit’

    }); my $email = $kit->assemble({ user => $user_object }); sendmail($email);
  4. Dear , Thank you for being a customer since .

    Your account has been due to . Please contact before at or we will be forced to your lovely wife Tracy’s head. Cheers, Anonymous
  5. Kit Manifest { "renderer" : "TT", “validator”: “Rx”, "header" :

    [ { "Subject": "Hello [% user.name %]" }, { "From": "Test Sender <[email protected]>" }, { "To": "[% user.email %]" } ], "alternatives": [ { "type": "text/plain", "path": "body.txt" }, { "type": "text/html", "path": "body.html" } ], "attachments": [ { "path": "demands.rtf" } ] }
  6. Assembling the Kit my $kit = Email::MIME::Kit->new({ source => ‘msg.mkit’

    }); my $email = $kit->assemble({ user => undef }); undefined value tag: [ “/err/nil” ], data path: [ “user” ], schema path: [ “user” ] at slide 42, line 3
  7. Annoying Crap: Dealt With if user.name is Ævar... if attachments

    are binary... text-only (singlepart) mail...
  8. Annoying Crap: Dealt With if user.name is Ævar... if attachments

    are binary... text-only (singlepart) mail... HTML with images as attachments...
  9. Some Kits... ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg

    ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json
  10. Some Kits... ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg

    ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json
  11. Some Kits... ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg

    ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json ./body.html ./body.txt ./logo.jpg ./background.jpg ./manifest.json
  12. The Kit Reader EMKit gets at its contents with the

    kit reader normally, just looks for files in the kit directory
  13. SWAK! you can write your own kit reader SWAK: Path::Resolver

    /kit/body.html body.html /fs/usr/share/app/body.html
  14. SWAK in Use ./body.html ./body.txt ./manifest.json ./body.html ./body.txt ./manifest.json ./body.html

    ./body.txt ./manifest.json /dist/YourApp/logo.jpg /dist/YourApp/background.jpg
  15. SWAK in Use ./body.html ./body.txt ./manifest.json ./body.html ./body.txt ./manifest.json ./body.html

    ./body.txt ./manifest.json /dist/YourApp/logo.jpg /dist/YourApp/background.jpg