PHP - 纯文本电子邮件 [英] PHP - Plain text email

查看:138
本文介绍了PHP - 纯文本电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将其变成纯文本电子邮件?

How to turn this into a 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

Is it just removing the HTML part and changing text/html into text/plain?

推荐答案

技巧,但您可能希望将内容类型更改为text / plain:

Removing the HTML should do the trick but you'll probably want to change the content-type to text/plain as well:

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



(I would have let a comment suffice but I can't post comments yet :))

这篇关于PHP - 纯文本电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆