Exclamation Point Randomly In Result of PHP HTML-Email

后端 未结 4 1306
自闭症患者
自闭症患者 2021-01-04 08:26

I\'m getting exclamation points in random spots in the result of this PHP email function. I read that it\'s because my lines are too long or I have to encode the email in Ba

4条回答
  •  感情败类
    2021-01-04 08:32

    The answers here have the correct information regarding the line length, however none of them provided me with the sufficient code snippet to fix the issue. I looked around and found the best way to do this, here it is;

    ".$eol;
    $headers .= "Content-Type: multipart/alternative; boundary=\"$separator\"".$eol;
    $headers .= "--$separator".$eol;
    $headers .= "Content-Type: text/html; charset=utf-8".$eol;
    $headers .= "Content-Transfer-Encoding: base64".$eol.$eol;
    
    // message body
    $body = rtrim(chunk_split(base64_encode($html)));
    
    mail($email, $subject, $body, $headers);
    // ==============================================
    

提交回复
热议问题