Php 如何使用wp_mail()在邮件头中显示图像

Php 如何使用wp_mail()在邮件头中显示图像,php,wordpress,image,email,html-email,Php,Wordpress,Image,Email,Html Email,如何在电子邮件标题中显示图像。我在下面试过,它在gmail中没有显示图像。请任何人帮我解决这个问题 $to = $_REQUEST['userEmail']; $firstName = $_REQUEST['firstName']; $lastName = $_REQUEST['lastName']; $email = $_REQUEST['email']; $question = $_POST['message']; $subject = 'Te

如何在电子邮件标题中显示图像。我在下面试过,它在gmail中没有显示图像。请任何人帮我解决这个问题

    $to = $_REQUEST['userEmail'];
    $firstName = $_REQUEST['firstName'];
    $lastName = $_REQUEST['lastName'];
    $email = $_REQUEST['email'];
    $question = $_POST['message'];
    $subject = 'Test Email';
    $message = "<html><head><img src='http://192.168.1.157/Shop/wp-content/uploads/2016/07/image_nmae.png'/></head>"
            . "<body><h1>Visitor Information</h1>"
            . "<p>Visitor Information: Fist Name:&nbsp;&nbsp;".$firstName."&nbsp;&nbsp; Last Name:&nbsp;&nbsp; ".$lastName."</p>"
            . "<p>Email:&nbsp;&nbsp;".$email."</p><p>Question:&nbsp;&nbsp;".$question."</p></body></html>";
    $headers = array('Content-Type: text/html; charset=UTF-8');
    $mailSend = wp_mail($to, $subject, $message,$headers);
$to=$\u请求['userEmail'];
$firstName=$_请求['firstName'];
$lastName=$\请求['lastName'];
$email=$_请求['email'];
$question=$_POST['message'];
$subject='testemail';
$message=“”
. “访客信息”
. “访客信息:名字:.$firstName。姓氏:.$lastName。”

” . “电子邮件:“.$Email.”

问题:“.$Question.”

”; $headers=array('Content-Type:text/html;charset=UTF-8'); $mailSend=wp_mail($to、$subject、$message、$headers);
这取决于用户的Gmail帐户,就像在我的Gmail帐户中我关闭了图像渲染一样,它会请求我是否允许加载它们

标签移动到
标签内,在头部标签内显示图像不是一个好的做法

如果它不起作用,那么将其写入
functions.php
文件中

add_filter( 'wp_mail_content_type', 'set_content_type' );
function set_content_type( $content_type ) {
    return 'text/html';
}

你试过我的密码吗?这有帮助吗?