Scroll to navigation

Sisimai::RFC2045(3pm) User Contributed Perl Documentation Sisimai::RFC2045(3pm)

NAME

Sisimai::RFC2045 - MIME Utilities

SYNOPSIS

    use Sisimai::RFC2045;
    my $e = '=?utf-8?B?55m954yr44Gr44KD44KT44GT?=';
    my $v = Sisimai::RFC2045->is_encoded(\$e);
    print $v;   # 1
    my $x = Sisimai::RFC2045->decodeH([$e]);
    print $x;

DESCRIPTION

"Sisimai::RFC2045" is MIME Utilities for Sisimai, is formerly known as "Sisimai::MIME".

CLASS METHODS

"is_encoded(Scalar Reference)"

is_encoded() method returns that the argument is a MIME-Encoded string or not.

    my $e = '=?utf-8?B?55m954yr44Gr44KD44KT44GT?=';
    my $v = Sisimai::RFC2045->is_encoded(\$e);  # 1

"decodeH(Array-Ref)"

decodeH() method is a decoding method for getting the original string from the MIME-Encoded string in the email headers.

    my $r = '=?utf-8?B?55m954yr44Gr44KD44KT44GT?=';
    my $v = Sisimai::RFC2045->decodeH([$r]);

"decodeB(\String)"

"decodeB" method is a decoding method for getting the original string from the MIME Base64 encoded string.

    my $r = '44Gr44KD44O844KT';
    my $v = Sisimai::RFC2045->decodeB(\$r);

"decodeQ(\String)"

"decodeQ" method is a decoding method for getting the original string from the MIME quoted-printable encoded string.

    my $r = '=4e=65=6b=6f';
    my $v = Sisimai::RFC2045->decodeQ(\$r);

"parameter(String, String)"

parameter() method returns the value of parameter in "Content-Type:" header.

    my $r = 'Content-Type: multipart/mixed; boundary=Apple-Mail-1-526612466'; charset=utf8;
    print Sisimai::RFC2045->parameter($r, 'charset');  # utf8
    print Sisimai::RFC2045->parameter($r, 'boundary'); # Apple-Mail-1-526612466
    print Sisimai::RFC2045->parameter($r);             # multipart/mixed

"boundary(String, Integer)"

boundary() method returns the boundary string from the value of "Content-Type:" header.

    my $r = 'Content-Type: multipart/mixed; boundary=Apple-Mail-1-526612466';
    my $v = Sisimai::RFC2045->boundary($r);
    print $v;   # Apple-Mail-1-526612466
    print Sisimai::RFC2045->boundary($r, 0); # --Apple-Mail-1-526612466
    print Sisimai::RFC2045->boundary($r, 1); # --Apple-Mail-1-526612466--

"haircut(\String, Boolean)"

haircut() method remove unused headers from the "multipart/* "block.

"levelout(String, \String)"

"levelout" method breaks the "multipart/*" message block into each part and returns an array reference.

"makeflat(String, \String)"

"makeflat" method makes flat "multipart/*" message: This method breaks "multipart/*" block into each part, remove parts which are not needed to decode the bounce message such as "image/*" MIME type, and decode the encoded text part ("text/*", "message/*") in the body of each part that has "Content-Transfer-Encoding:" header and the value of the header is quoted-printabe, base64, or 7bit.

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014-2016,2018-2024 azumakuniyuki, All rights reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.

2025-04-12 perl v5.40.1