3

重複の可能性:
PHPメール、CCフィールド

私は次のphpを使用してメールを送信しています。メールにccを追加する必要があります。ヘッダーに挿入しようとすると、htmlメッセージに生のhtmlが表示されます。ccを処理するための最良の方法は何ですか?

ありがとう

$headers = "From: $from_email\r\nReply-To: $from_email";

$headers .= "Return-Path: <info@premierinspectiontn.com>";

//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
4

2 に答える 2

16

これをテストしたところ、期待どおりに機能しました。

$headers .= 'Cc: test@test.com\r\n';
$headers .= 'Bcc: test@test.com\r\n';

また、キャリッジリターンと改行を前のエントリの最後に移動することをお勧めします$headers

$headers = "From: $from_email\r\nReply-To: $from_email";
$headers .= 'Cc: test@test.com\r\n';
$headers .= 'Bcc: test@test.com\r\n';
$headers .= "Return-Path: <info@premierinspectiontn.com>\r\n";

// add boundary string and mime type specification
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

それが役立つことを願っています

于 2012-01-27T22:48:10.837 に答える
0

追加してみてください

$headers .= 'CC: other@url.com' . "\r\n";
于 2012-01-27T22:46:42.967 に答える