簡體   English   中英

PHP - 純文本電子郵件

[英]PHP - Plain text email

如何將其轉換為純文本電子郵件?

 $bound_text=md5(uniqid(time()));
    $headers.="MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"PHP-mixed-$bound_text\"\r\n";

    $message="--PHP-mixed-$bound_text\r\n"      
                ."Content-Type: text/html; charset=\"utf-8\"\r\n"
                ."Content-Transfer-Encoding: 7bit\r\n\r\n"  
                ."<html><head></head><body>"
                ."<div style=\"font-family: Arial, Helvetica, sans-serif; font-size : 1.3em; color: #000000;width: 100%;text-align: left;\">$text_message</div></body></html>\r\n\r\n"  
                ."--PHP-mixed-$bound_text\r\n"  
                ."Content-Transfer-Encoding: base64\r\n"
                ."Content-Disposition: attachment; filename=\"$attachment\"\r\n"
    ."Content-Type: image/jpeg; name=\"$attachment\"\r\n\r\n"
     .chunk_split($file)
            ."\r\n\r\n"
                ."--PHP-mixed-$bound_text--\r\n\r\n";

    }

它只是刪除HTML部分並將text / html更改為text / plain

刪除HTML應該可以解決問題,但您可能也希望將內容類型更改為text / plain:

."Content-Type: text/plain; charset=\"utf-8\"\r\n"

(我會讓評論足夠,但我還不能發表評論:))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM