さくらインターネットで添付画像付きのマルチパートメールを送る

さくらインターネットで添付画像付きのマルチパートメールをPHPで送ってみる、という記事がウノウラボさんで公開されています。

ベタ書きで、メール送信の仕組みがわかる記事になっていると思います。用途が限定されているならばこういう風にサクっと書いてしまうのもよいですよね。

この例に挙げられている用に

//ヘッダ情報
$sendto = “ここに宛先メアド”;
$subject = “ここにサブジェクト”;
$headers = “FROM:” . “ここに送信元メアド”. “\r\n”;
$headers .= ‘MIME-Version: 1.0′ . “\r\n”;
$headers .= ‘Content-Type: multipart/related;boundary=”1000000000″‘ . “\r\n”;

//テキストパート、HTMLパート
$message =<<

--1000000000
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

boundaryを1000000000にするというのはよくある手法なのでしょうか。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">