生活を困難にするために、私が働いているクライアントは、PHP4.0で実行される非常に大規模で古いシステムを使用しており、追加のライブラリを追加することを望んでいません.
添付ファイルとそれに付随する text/html コンテンツの両方を含む PHP 経由で電子メールを送信しようとしていますが、両方を 1 つの電子メールで送信することはできません。
これにより、添付ファイルが送信されます。
$headers = "Content-Type: text/csv;\r\n name=\"result.csv\"\r\n Content-Transfer-Encoding: base64\r\n Content-Disposition: attachment\r\n boundary=\"PHP-mixed-".$random_hash."\"";
$output = $attachment;
mail($emailTo, $emailSubject, $output, $headers);
これは text/html を送信します:
$headers = "Content-Type: text/html; charset='iso-8859-1'\r\n";
$output = $emailBody; // $emailBody contains the HTML code.
これにより、添付ファイルの内容とともに text/html を含む添付ファイルが送信されます。
$headers = "Content-Type: text/html; charset='iso-8859-1'\r\n".$emailBody."\r\n";
$headers = "Content-Type: text/csv;\r\n name=\"result.csv\"\r\n Content-Transfer-Encoding: base64\r\n Content-Disposition: attachment\r\n boundary=\"PHP-mixed-".$random_hash."\"";
$output = $attachment;
私が知る必要があるのは、メール本文に text/html を含むメールを送信し、それに添付ファイルを追加する方法です。ここで本当に単純なものが欠けていると確信しています!
前もって感謝します。