Include html in email

后端 未结 4 1343
遇见更好的自我
遇见更好的自我 2020-12-22 12:02

I need to include some HTML things in PHP, for example to add link in a message like this:



        
4条回答
  •  遥遥无期
    2020-12-22 12:35

    I didn't understand. You need to echo to the html like this ?

    echo ' Link ';
    

    Or do you need to do this :

    $body .= ' Link ';
    

    What's exactly that you are trying to do ?

    If you are trying to send HTML data via mail(), you need to set few headers

        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=utf8' . "\r\n";
        mail($to, $subject, $body, $headers);
    

    For more information - check http://php.net/manual/en/function.mail.php example 4

提交回复
热议问题