-1

現在、すべての情報を変数に保存しています

$email_body = "";
$email_body = $email_body . "<b>Name:</b>" . $name . "\n";
$email_body = $email_body . "E-mail:" . $email . "\n";
$email_body = $email_body . "Phone Number:" . $phnum . "\n";
$email_body = $email_body . "Message:" . $message . "\n";

$messageSend = $email_body;

mail($to,$subject,$messageSend,$headers);

タグ、CSSなど<br/>のhtml を追加するにはどうすればよいですか?<b>

4

2 に答える 2

2

Content-Type次のようなヘッダーに追加します

$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

<html><body>そして、メッセージなどを</body></html>追加します

$email_body = '<html><body>';
$email_body .= "<b>Name:</b>" . $name . "\n";
$email_body .= "<b>E-mail:</b>" . $email . "\n";
$email_body .= "<b>Phone Number:</b>" . $phnum . "\n";
$email_body .= "<b>Message:</b>" . $message . "\n";
$email_body .= '</body></html>';
于 2013-08-06T06:36:09.360 に答える
0

"\n" は HTML では機能しません。このように "paragraph" タグを使用します。

$email_body = "<html><body>";
$email_body .= "<b>Name:</b>" . $name . "<p>";
$email_body .= "<b>E-mail:</b>" . $email . "<p>";
$email_body .= "<b>Phone Number:</b>" . $phnum . "<p>";
$email_body .= "<b>Message:</b>" . $message . "<p>";
$email_body .= "</body></html>";
于 2013-08-06T06:56:28.917 に答える