[3.013] This is tricky. It is hard to detect whether the body originates from the program, or from an external source. And what about a database database? are those octets or strings? Please read Autodetection of character-set.
Option | Default |
---|---|
external | <false> |
[3.013] When a body object does not specify its character-set, but that
detail is required, then it gets autodetected. The default algorithm is
implemented in charsetDetect(). You may change this default algorithm,
or pass option charset_detect
for each call to encode().
When you call this method with an explicit undef
, you reset the default.
(Without parameter) the current algorithm (CODE or method name) is
returned.
Check the content of the body not to include illegal characters. Which characters are considered illegal depends on the encoding of this body.
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.
Encode (translate) a Mail::Message::Body into a different format. See the DESCRIPTION above. Options which are not specified will not trigger conversions.
Option | Default |
---|---|
charset |
|
charset_detect | <built-in> |
mime_type | undef |
result_type | <same as source> |
transfer_encoding | undef |
The encoding or decoding of a message body encounters a character set which is not understood by Perl's Encode module.
The data (message body) is encoded in a way which is not currently understood, therefore no decoding (or recoding) can take place.
The data (message body) has been decoded, but the required encoding is unknown. The decoded data is returned.
Encode the body to a format what is acceptable to transmit or write to a folder file. This returns the body where this method was called upon when everything was already prepared, or a new encoded body otherwise. In either case, the body is checked.
Option | Default |
---|---|
charset_detect | <the default> |
Unify the type of the given $body objects with the type of the called
body. undef
is returned when unification is impossible. If the
bodies have the same settings, the $body object is returned unchanged.
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).
Various fields are searched for filename
and name
attributes. Without
$directory, the name found will be returned unmodified.
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.
Returns true when the un-encoded message is binary data. This information is retrieved from knowledge provided by MIME::Types.
Returns true when the un-encoded message contains printable text.
Relate the NAMEd transfer encoding to an OBJECTs or object of the specified $class. In the latter case, an object of that $class will be created on the moment that one is needed to do encoding or decoding.
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?
Get the transfer encoder/decoder which is able to handle $type, or return undef if there is no such handler.