Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP wp_邮件smtp_Php_Email - Fatal编程技术网

PHP wp_邮件smtp

PHP wp_邮件smtp,php,email,Php,Email,我正在尝试开发一个快速邮件功能,当它被触发时,会向管理员发送一封简短的电子邮件。当测试大约10次时,我只收到2封电子邮件,这花了相当长的时间才进入我的收件箱。我知道主机可能会阻止这种类型的邮件功能,所以我开始考虑设置一个SMTP表单,并在其中实现以下功能。经过4个小时的努力,我仍然没有设置一个函数,可以向一个电子邮件地址发送几个变量。很明显我做错了什么,有人能告诉我正确的方向吗?多谢各位 PHP $from = "xxx"; $to = "xxx"; $subject = "Subject";

我正在尝试开发一个快速邮件功能,当它被触发时,会向管理员发送一封简短的电子邮件。当测试大约10次时,我只收到2封电子邮件,这花了相当长的时间才进入我的收件箱。我知道主机可能会阻止这种类型的邮件功能,所以我开始考虑设置一个SMTP表单,并在其中实现以下功能。经过4个小时的努力,我仍然没有设置一个函数,可以向一个电子邮件地址发送几个变量。很明显我做错了什么,有人能告诉我正确的方向吗?多谢各位

PHP

$from = "xxx";
$to = "xxx";
$subject = "Subject";

/* Message */
$message = '<strong>Customer Details</strong><br/>';
$message .= 'Name: '. $first_name .' '. $last_name .'<br/>';
$message .= 'Email: '. $email .'<br/>';
$message .= 'Phone: '. $phone .'<br/>';
$message .= '<br/>';
$message .= '<strong>Order Details</strong><br/>';
$sub_ = $order->get_items();
foreach($sub_ as $sub){
  $message .= $sub['name'].'<br/>';
}

$header = "From:" . $from;
wp_mail($to,$subject,$message,$header);
$from=“xxx”;
$to=“xxx”;
$subject=“subject”;
/*信息*/
$message='客户详细信息
'; $message.=“名称:”$第一个名字$姓氏“
”; $message.=“电子邮件:”$电子邮件“
”; $message.=“电话:”$电话。
; $message.='
'; $message.='订单详细信息
'; $sub_=$order->get_items(); foreach($sub_uuu作为$sub){ $message.=$sub['name'].
; } $header=“From:”$从…起 wp_邮件($to、$subject、$message、$header);

默认情况下,
wp\u mail()
不支持HTML内容。你需要做
add_filter('wp_mail_content_type','text/html')发送前