Mail::Message::Body::Encode(3pm) | User Contributed Perl Documentation | Mail::Message::Body::Encode(3pm) |
Mail::Message::Body::Encode - organize general message encodings
my Mail::Message $msg = ...; my $decoded = $msg->decoded; my $encoded = $msg->encode(mime_type => 'image/gif', transfer_encoding => 'base64'); my $body = $msg->body; my $decoded = $body->decoded; my $encoded = $body->encode(transfer_encoding => '7bit');
Manages the message's body encodings and decodings on request of the main program. This package adds functionality to the Mail::Message::Body class when the decoded() or encode() method is called.
Four types of encodings are handled (in the right order)
Various operating systems have different ideas about how to encode the line termination. UNIX uses a LF character, MacOS uses a CR, and Windows uses a CR/LF combination. Messages which are transported over Internet will always use the CRLF separator.
Messages transmitted over Internet have to be plain ASCII. Complicated characters and binary files (like images and archives) must be encoded during transmission to an ASCII representation.
The implementation of the required encoders and decoders is found in the Mail::Message::TransferEnc set of packages. The related manual page lists the transfer encodings which are supported.
NOT IMPLEMENTED YET
A body is returned which is checked. This may be the body where this method is called upon, but also a new object, when serious changes had to be made. If the check could not be made, because the decoder is not defined, then "undef" is returned.
-Option --Default charset PERL if text mime_type undef result_type <same as source> transfer_encoding undef
Examples:
my $bodytype = Mail::Message::Body::Lines; my $html = $bodytype->new(mime_type=>'text/html', data => []); my $plain = $bodytype->new(mime_type=>'text/plain', ...); my $unified = $html->unify($plain); # $unified is the data of plain translated to html (if possible).
When a $directory is given, a filename is composed. For security reasons, only the basename of the found name gets used and many potentially dangerous characters removed. If no name was found, or when the found name is already in use, then an unique name is generated.
Don't forget to read RFC6266 section 4.3 for the security aspects in your email application.
The $class or $object must extend Mail::Message::TransferEnc. It will replace existing class and object for this $name.
Why aren't you contributing this class to MailBox?
This module is part of Mail-Message distribution version 3.008, built on February 11, 2019. Website: http://perl.overmeer.net/CPAN/
Copyrights 2001-2019 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
2019-02-15 | perl v5.28.1 |