- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- 携帯/デコメール送信(Perl) へ行く。
- 1 (2009-09-01 (火) 06:15:04)
- 2 (2009-09-01 (火) 06:46:38)
- 3 (2009-09-01 (火) 10:01:15)
- 4 (2009-09-01 (火) 17:36:28)
デコメール送信
資料
キャリア公式
- ドコモ
- AU
- ソフトバンク
デコメール携帯4社MIMEマルチパート比較
開封率の高いデコメールでメルマガ配信!
Perlを使ったドコモデコメールの実例
CPAN
- MIME::Lite http://search.cpan.org/perldoc?MIME::Lite
サンプルコード
AU
#!/usr/local/bin/perl
use strict;
use MIME::Lite;
use HTML::Scrubber;
use Jcode;
use Path::Class;
my $html = <<'END';
<html>
<body>
<font color="#FF0000">こんにちは</font>
<img src="cid:my@image">
</body>
</html>
END
my $scrubber = HTML::Scrubber->new;
my $text = $scrubber->scrub($html);
my $alternative = MIME::Lite->new( Type => 'multipart/alternative', );
$alternative->attach(
Type => 'text/html',
Data => Jcode->new($html)->jis,
Encoding => '8bit',
);
$alternative->attach(
Type => 'text/plain',
Data => $text,
Encoding => '8bit',
);
my $image = MIME::Lite->new(
Type => 'image/gif; name="image.gif"',
Id => '<my@image>',
Data => scalar file( '.', 'image.gif' )->slurp,
Encoding => 'base64',
);
my $msg = MIME::Lite->new(
Type => 'multipart/mixed',
Subject => 'hello',
From => 'taro@example.net',
To => 'hanako@ezweb.ne.jp',
);
$msg->attach($alternative);
$msg->attach($image);
$msg->send;
Contents-IDは"@"を1つだけ含まなければならない。2個以上含んではならない(とのこと→http://www.cpa-lab.com/tech/0135)。