Skip to content

Instantly share code, notes, and snippets.

@punytan
Created January 30, 2011 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punytan/802596 to your computer and use it in GitHub Desktop.
Save punytan/802596 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use utf8;
use Encode;
use Email::MIME::Creator;
use Email::Sender::Simple qw/sendmail/;
sub send {
my $email = shift;
my $body = '文字列';
my $mail = Email::MIME->create(
header => [
From => 'noreply@example.com',
To => $email,
Subject => encode('MIME-Header', 'いろはにほへと'),
],
attributes => {
content_type => 'text/plain',
charset => 'utf8',
encoding => '8bit',
},
body_str => $body,
);
sendmail($mail, {from => 'noreply@example.com'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment