通过电子邮件发送用户可以使用但不是管

时间:2012-11-14 04:42:52

标签: php wordpress

我有一个处理过的订单,客户收到了电子邮件,但是,添加管理位不会给管理员发送电子邮件?

以下代码是发送给客户的位(工作正常)以及 的代码也会通过电子邮件发送给管理员但不会:(

    // email stuff (change data below)
    $to = $payment_data['sold_to_email']; 
    $from = $order_options['admin_email']; 
    $subject = "Your Order"; 

    //include the message
    $message = $order_options['email_message'];
    //Build the Order out
    $message .= '<br /><br />Thank you for purchasing from us';

    // a random hash will be necessary to send mixed content
    $separator = md5(time());

    // carriage return type (we use a PHP end of line constant)
    $eol = PHP_EOL;

    // main header (multipart mandatory)
    $headers  = "From: ". $company . " <" . $from . ">". $eol;
    $headers .= "MIME-Version: 1.0".$eol; 
    $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; 
    $headers .= "Content-Transfer-Encoding: 7bit".$eol;
    $headers .= "This is a MIME encoded message.".$eol.$eol;

    // message
    $headers .= "--".$separator.$eol;
    $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
    $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
    //$headers .= $message.$eol.$eol;

    // send message
    $sendit = wp_mail($to, $subject, $message, $headers);

    $admin_message = $payment_data['admin_field'];
    wp_mail($admin_email, 'New Order', $admin_message);

    //Code to troubleshoot email problems.
    /*  if(!$sendit) {
                $tempOptions = get_option('order_options');
                $tempOptions['admin_email'] = "EMAIL FAILED";
                update_option('order_options', $tempOptions);

            }
    */

0 个答案:

没有答案