App::Smarkmail - pipemailer that changes plaintext to multi/alt with Markdown
This module implements logic used by the smarkdown command, which accepts an email message on standard input, tries to convert it from a plaintext message to multipart alternative, and then sends it via sendmail
All of this is really sketchy and probably has secret mail-damaging or mail-losing bugs. -- rjbs, 2008-02-24
my $email = App::Smarkmail->markdown_email($message, \%arg);
This method accepts an email message, either as an Email::MIME object or as a string or a reference to a string, and returns an Email::MIME object. If the method is passed an object, the object will be altered in place.
If the message is a single part plaintext message, or a multipart/mixed or multipart/related message in which the first part is plaintext, then the plaintext part will be replaced with a multipart/alternative part. The multi/alt part will have two alternatives, text and HTML. The HTML part will be generated by running the plaintext part through Text::Markdown.
If the text message ends in a signature -- that is, a line containing only "--\x20" followed by no more than five lines -- the signature will be excluded from Markdown processing and will be appended to the HTML part wrapped in
Note that the HTML alternative is listed second, even though it is less true to the original composition than the first. This is because the assumption is that you want the recipient to see the HTML part, if possible. Multipart/alternative messages with HTML parts listed before plaintext parts seem to tickle some bugs in some popular MUAs.
Ricardo SIGNES <email@example.com>
This software is copyright (c) 2008 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.