Last active
January 28, 2019 00:32
-
-
Save rjbs/afd7520b8e58fc68f8d805e8f8e5ba91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.26.0; | |
use warnings; | |
use Email::MIME; | |
use Email::Simple; | |
{ | |
my $text = <<~'END'; | |
Header-A: Foo | |
Subject: =?UTF-8?B?VGhpcyBpcyBhIHJlYWxseSBsb25nIGxpbmUgdGhhdCB3aWxsIGVuZCB1cCBnb2luZyBvdmVyIDc4IGNoYXJhY3RlcnMgd2hlbiBlbmNvZGVkIGZvciBVVEYtOA==?= | |
Header-B: Bar | |
Body | |
END | |
my $email = Email::Simple->new($text); | |
print $email->as_string; | |
} | |
say '-' x 70; | |
{ | |
my $email = Email::Simple->create( | |
header => [ | |
'Header-A' => 'Foo', | |
'Subject' => '=?UTF-8?B?VGhpcyBpcyBhIHJlYWxseSBsb25nIGxpbmUgdGhhdCB3aWxsIGVuZCB1cCBnb2luZyBvdmVyIDc4IGNoYXJhY3RlcnMgd2hlbiBlbmNvZGVkIGZvciBVVEYtOA==?=', | |
'Header-B' => 'Bar', | |
], | |
body => 'Body', | |
); | |
print $email->as_string; | |
} | |
say '-' x 70; | |
{ | |
my $email = Email::MIME->create( | |
header_str => [ | |
'Header-A' => 'Foo', | |
'Subject' => "\N{CAT FACE}" . 'This is a really long line that will end up going over 78 characters when encoded for UTF-8', | |
'Header-B' => 'Bar', | |
], | |
body => 'Body', | |
); | |
print $email->as_string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment