0 レビュー
0 回答
ajax-テキストメールでphp変数をプレーンテキストとして送信します
Ajaxを使用して変数をphpファイルに渡し、通常の電子メールとテキストの両方を送信しています。変数は次のようにループしている配列です:
echo "<p class='names'>" . $give. " give to ".$receiving . "</p>";
そのため、通常のメールではうまく機能しますが、SMSテキストでは次のように表示されます。
<p class='names'>A give to B . "</p>"
テキストバージョンにA give to B
私のphpファイルでは、変数は $nameOutput = $_POST['nameOutput'];
のように記述されています。ファイルの後半で$nameOutput
に割り当てることができる関数はありますか?テキストコードの前に、変数を書き直してテキストのみをレンダリングしますが、ループごとに改行を入れますか?< / p>
つまり、次のようなものです:
A give to B
B give to C
これが可能かどうか誰か知っていますか?
コード:
$nameOutput = $_POST['nameOutput'];
$ email_send = $ _POST ['email'];
$ phone = $ _POST ['phone'];
$carrier = $ _POST['carrier'];
コードの後半のテキスト部分
$nameOutput = strip_tags($nameOutput、'
');
$ to_text =$phone。"@"。$carrier;
$ from_text = "[email protected]";
$ message = "これがあなたの結果です!" 。 "
"。 {-コード-5};
$ headers = "From:$ from \ n";
mail($ to_text、''、$ message、$ headers);
$nameOutput
は次のようにレンダリングします:
Paul & Becky give to Ashley & Jeric
Keith & Jackie give to Rob & Savannah
Dave & Lauren give to Paul & Becky
Ashley & Jeric give to Dave & Lauren
Rob & Savannah give to Keith & Jackie
最新のコード:
$ breaks = array( "
"、 "
"、 "
");
$nameOutput = str_ireplace($ breaks、 "\ r \ n"、$nameOutput);
$nameOutput = strip_tags($nameOutput);
// $nameOutput = strip_tags($nameOutput、'\ r \ n');
$ to_text =$phone。"@"。$carrier;
$ from_text = "[email protected]";
$ message = "これがあなたの結果です!" 。 "
"。 {-コード-5};
$ headers = "From:$ from \ n";
$ headers = "Content-Type:text / html; charset = UTF-8";
mail($ to_text、''、$ message、$ headers);
icecubの編集:
将来の読者のために明確にするために:彼はプレーンテキストのSMSメッセージについて話している。メールではありません!
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。