How to add html codes in email?

后端 未结 2 1184
遇见更好的自我
遇见更好的自我 2021-01-28 03:32

I have created a script that sends email automatically! My mail message is included in the following variable

$message

But when i include a h

相关标签:
2条回答
  • 2021-01-28 04:03

    If you are using the mail command make sure you Are setting the right headers eg

        $headers  = "From: $from\r\n";     $headers .= "Content-type: text/html\r\

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

    0 讨论(0)
  • 2021-01-28 04:05

    You could do something like:

    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $subject = "Subject here";
    $message = "email message here";
    
    $sendMail = mail("info@domain.com", "$subject", "$message", "$headers" );   
    
    0 讨论(0)
提交回复
热议问题