Wordpress不会向两个不同的电子邮件地址发送两封不同的电子邮件

时间:2016-05-27 19:16:20

标签: php wordpress email switch-statement

我正在开发一个网络应用程序,我很难让Wordpress将两封不同的电子邮件发送到两个不同的电子邮件地址。我两次打电话给wp_mail。第一个$消息总是发送,但第二个$确认不会发送。如果我使用变量来定义电子邮件中的“to”或硬代码并不重要,$ confirm永远不会发送。我尝试将单引号连接到电子邮件,以确保格式正确,但没有。

有没有人知道如何使用wp_mail正确发送两封不同的电子邮件?

我将发布我用于邮件的代码片段。我正在使用一个开关来引导客户完成订购过程。

我对此很新,所以我可能会遗漏一些语法,但任何帮助都会如此受到赞赏。

    case 5: // Confirmation
    /*if (!isset($order->dumpster_purpose)) {
        wp_redirect('/order');
        exit;
    }*/

    $message = '' . "
ORDER TYPE
------------------------------------------------------------
" . ($order->type == ORDER_TYPE_TEMP ? 'Temporary Rental' : 'Permanent Scheduled Pickup') . "


DUMPSTER INFORMATION
------------------------------------------------------------
Dumpster: {$order->dumpster}
Dumpster Amount: {$order->dumpster_amount}
Purpose for Dumpster: {$order->dumpster_purpose}
Needed for: {$order->dumpster_use}
Schedule Type: {$order->schedule_type}
Disposing of:
";
    foreach($order->disposing_materials as $material) {
        $message.= " - {$material}\r\n";
    }

    $message.= "

DELIVERY INFORMATION
------------------------------------------------------------
Name: {$order->full_name}
";
    if (!empty($order->business_name)) $message.= "Business Name: {$order->business_name}\r\n";
    $message.= "Phone: {$order->phone}
Email: {$order->email}
";
    $message.= "
Address:
{$order->d_address}
{$order->d_city}, {$order->d_state} {$order->d_zip}
";
    $message.= "
Delivery Date: {$order->d_date}
";
    if (!empty($order->instructions)) $message.= "\r\nDelivery Instructions:\r\n{$order->instructions}\r\n";
    if (FALSE && $order->type == ORDER_TYPE_TEMP) {
        $message.= "

BILLING INFORMATION
------------------------------------------------------------
Address:
{$order->b_address}
{$order->b_city}, {$order->b_state} {$order->b_zip}

Card Info:
{$order->card_type}
{$order->card_number}
{$order->card_code}
{$order->card_exp_month}/{$order->card_exp_year}
";
    }

    wp_mail(ORDER_RECIPIENTS, $order->type == ORDER_TYPE_TEMP ? 'Online Dumpster Order' : 'Online Dumpster Quote Request', $message);

        $confirmation = '' . "
ORDER TYPE
------------------------------------------------------------
" . ($order->type == ORDER_TYPE_TEMP ? 'Temporary Rental' : 'Permanent Scheduled Pickup') . "


DUMPSTER INFORMATION
------------------------------------------------------------
Dumpster: {$order->dumpster}
Dumpster Amount: {$order->dumpster_amount}
Purpose for Dumpster: {$order->dumpster_purpose}
Needed for: {$order->dumpster_use}
Schedule Type: {$order->schedule_type}
Disposing of:
";
$email = $order->email;
    wp_mail($email, $order->type == ORDER_TYPE_TEMP ? 'Online Dumpster Order' : 'Online Dumpster Quote Request', $confirmation);
    //session_destroy();
    break;
}

0 个答案:

没有答案