wordpress wp_mail 将我的 html 消息作为文本附件发送 [英] wordpress wp_mail is sending my html message as a text attachment

查看:30
本文介绍了wordpress wp_mail 将我的 html 消息作为文本附件发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是发送邮件的代码:

$to = $_POST['leadEmail'];
$subject = "my subject";
$message = ( $_POST['leadEmailPref'] == "html" ) ? $messageh : $messagep ;
$headers[] = "From: My Name <ny_name@gmail.com>";
$headers[] = "Content-type: ".$_POST['leadEmailPref'] ;

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

当我进入收件箱时,邮件以附件形式发送,但我没有看到邮件.显然我不想要附件,我想让收到邮件的人立即看到邮件.

When I go to my inbox, the message is sent as an attachment and I don't see the message. Obviously I don't want the attachment, and I want the person who receives the email to see the message immediately.

推荐答案

你的 Content-type: 是错误的.它应该是 text/htmltext/plain,而不是 html.

Your Content-type: is wrong. It should be text/html or text/plain, not html.

$headers[] = "Content-type: text/".$_POST['leadEmailPref'] ;

这篇关于wordpress wp_mail 将我的 html 消息作为文本附件发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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