The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sisimai::MIME - MIME Utilities

SYNOPSIS

    use Sisimai::MIME;

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

    my $x = Sisimai::MIME->mimedecode([$e]);
    print $x;

DESCRIPTION

Sisimai::MIME is MIME Utilities for Sisimai.

CLASS METHODS

is_mimeencoded(Scalar Reference)

is_mimeencoded() returns that the argument is MIME-Encoded string or not.

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

mimedecode(Array-Ref)

mimedecode() is a decoder method for getting the original string from MIME Encoded string in email headers.

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

base64d(\String)

base64d is a decoder method for getting the original string from MIME Base564 encoded string.

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

qprintd(\String)

qprintd is a decoder method for getting the original string from MIME Quoted- printable encoded string.

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

boundary(String)

boundary() returns a boundary string from the value of Content-Type header.

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

    print Sisimai::MIME->boundary($r, 0); # --Apple-Mail-1-526612466
    print Sisimai::MIME->boundary($r, 1); # --Apple-Mail-1-526612466--

breaksup(\String, String)

breaksup is a multipart/* message decoder: Decode quoted-printable, base64, and other encoded message part, leave only text/plain, message/*, text/html (only in multipart/alternative), returns string as a reference. This method is called from makeflat() and breaksup() itself.

makeflat(String, \String)

makeflat makes flat multipart/* message: it leaves only text/html, message/*, and text/html (Content-Type of upper part is not multipart/alternative) part. In other words, this method remove parts which is not needed to parse bounce message such as image/*, text/html inside of multipart/alternative.

    my $r = 'multipart/report; ...';    # Content-Type: MIME type, boundary
    my $b = '...';                      # Multipart message body
    my $v = Sisimai::MIME->makeflat($r, \$b);   # Returns scalar reference
    print $$v;                  # Flatten message body

AUTHOR

azumakuniyuki

COPYRIGHT

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

LICENSE

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