添加第二个电子邮件地址到变量php

时间:2015-09-25 07:15:24

标签: php email

我正在使用插件(简易数字下载)发送待处理购买的电子邮件,我需要在此电子邮件中添加第二个静态电子邮件地址,可以是直接或cc。我怎样才能做到这一点?这是当前的代码......

function eddcg_send_payment_instructions_email( $payment_id = 0 ) {

$email_body = edd_get_option( 'eddcg_pending_email' );

if ( empty ( $email_body ) ) {
    return;
}

$email_body = edd_do_email_tags( $email_body, $payment_id );

$subject = edd_do_email_tags( edd_get_option( 'eddcg_pending_email_subject' , __( 'Your purchase is pending payment', 'eddcg' ) ), $payment_id );

$user_info = edd_get_payment_meta_user_info( $payment_id );

EDD()->emails->heading = edd_do_email_tags( edd_get_option( 'eddcg_pending_email_heading', false ), $payment_id );

EDD()->emails->send( $user_info['email'],  $subject, $email_body );

}

1 个答案:

答案 0 :(得分:1)

EDD_Emails::send使用wp_mail

Codex说:

  

<强> $到

     

(字符串或数组)(必填)

     

预定的收件人。可以使用数组或逗号分隔的字符串指定多个收件人。

所以,这些将起作用

EDD()->emails->send( array( $user_info['email'], $second_user_info['email'] ),  $subject, $email_body );

EDD()->emails->send( $user_info['email'].','.$second_user_info['email'],  $subject, $email_body );