小编Jam*_*son的帖子

wp_mail html 电子邮件文本区域中的换行符

我在使用 wp_mail 函数时遇到问题,希望有人可以帮助我。

我需要在用户添加到文本区域“消息”的电子邮件中插入换行符。

有人可以帮忙吗?

我目前有以下代码从联系表单发送电子邮件:

<?php

if( !isset($_REQUEST) ) return;

require('../../../../wp-load.php');
function wpse27856_set_content_type(){
return "text/html";
}
add_filter( 'wp_mail_content_type','wpse27856_set_content_type' );

$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$msg = $_REQUEST['message'];


$headers = 'From: '.$name.' <'.$email.'>' . "\r\n";
$message = '
<html>
<body>
Someone has made an enquiry on the online contact form:

<br /><br />
        <b>Contact Details:</b><br />
        '.$name.'<br />
        '.$phone.'<br />
        '.$email.'<br /><br />
        <b>Message:</b><br />
        '.$msg.'<br />

        <br /><br />


</body>
</html>
            ';

wp_mail('email@email.co.uk', 'Contact form …
Run Code Online (Sandbox Code Playgroud)

html php email wordpress

4
推荐指数
1
解决办法
8985
查看次数

标签 统计

email ×1

html ×1

php ×1

wordpress ×1