如何在PHP mail()中使文本加粗?
我想在我的电子邮件内容中发送一些粗体文本。我使用了以下代码如何在PHP mail()中使文本加粗?,php,function,email,syntax,output,Php,Function,Email,Syntax,Output,我想在我的电子邮件内容中发送一些粗体文本。我使用了以下代码 $to = 'some@gmail.com'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset=UTF-8' . "\r\n"; $from = $param['email']; // this is the sender's Email address $headers
$to = 'some@gmail.com';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\r\n";
$from = $param['email']; // this is the sender's Email address
$headers = "From:" . $from;
$name = $param['name'];
$subject = "Test";
$message = "message.\n\n"
."<b>Name:</b> ".$name . "\n\n"
."Adress: \n"
.$param['address'] . "\n"
.$param['zip'] . ", "
.$param['postal_area'] . "\n\n"
."E-post: ".$param['email'] . "\n\n\n"
mail($to,$subject,$message,$headers);
$to='1!'some@gmail.com';
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=UTF-8'。“\r\n”;
$from=$param['email'];//这是发件人的电子邮件地址
$headers=“From:”$从…起
$name=$param['name'];
$subject=“Test”;
$message=“消息。\n\n”
“名称:”.$Name。“\n\n”
“地址:\n”
.$param['address']。“\n”
.$param['zip']。", "
.$param[“邮政区”]。“\n\n”
“E-post:”.$param['email']。“\n\n\n”
邮件($to、$subject、$message、$headers);
我也使用了
而不是
标记,但没有任何效果。
我收到的邮件格式如下:
<b>Namn:</b> some name
Adress:
Borås, Sweden
4837, Boras
E-post: somemail@gmail.com
Namn:一些名字
地址:
瑞典博尔斯
4837,波拉斯
电子邮政:somemail@gmail.com
您再次覆盖标题变量。您需要附加到它
$headers .= "From:" . $from; //You forgot to concatenate here...
// ---^ //Add the .
尝试在跨距中设置字体权重属性:
$message = "E-post: <span style='font-weight:strong;'>".$param['email']."</span>";
$message=“E-post:“.param['email']”;
但也可以看到其他回复,您正在覆盖标题,因此它不会以HTML形式读取消息