如何在PHP mail()中使文本变为粗体?

Jit*_*esh 3 php email syntax function 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 = "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);
Run Code Online (Sandbox Code Playgroud)

我也使用了<strong>而不是<b>标签,但没有任何作用.我收到以下格式的邮件:

<b>Namn:</b> some name

Adress:
Borås, Sweden
4837, Boras

E-post: somemail@gmail.com
Run Code Online (Sandbox Code Playgroud)

Sha*_*ran 12

您将再次覆盖标头变量.你需要附加它.

 $headers .= "From:" . $from; //You forgot to concatenate here...
//     ---^ //Add the .
Run Code Online (Sandbox Code Playgroud)