Multiple Customer Emails.

This topic contains 2 replies, has 3 voices, and was last updated by  Patrik 4 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #3851

    cybergoats
    Free User

    i have a need to CC people when i send an invoice. Can you add a customer CC and maybe a BCC field that can allow more that one email address separated by a comma.

    #3852

    Alex Rollin
    Moderator
    Post count: 27815

    The developers will consider that for a future version.

    #3855

    Patrik
    Moderator
    Post count: 1971

    Hi,

    This is not easily possible currently without customization. You can try following code snippet by putting into the active theme’s functions.php file or creating a snippet using Code Snippets plugin from the backend:

    
    add_action('wpinv_post_send_invoice_notification', 'send_user_invoice_mail_cc', 10, 2);
    function send_user_invoice_mail_cc($invoice, $email_type){
    	if(isset($email_type) && 'user_invoice' != $email_type){
    		return false;
    	}
    
    	if ( empty( $invoice ) ) {
    		return false;
    	}
    
    	$invoice_id = $invoice->ID;
    
    	$recipient  = 'abc@mycompany.com, xyz@mycompany.com'; //change to your CC email addresses
    	$subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
    	$email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
    	$headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
    	$message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
    	$attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
    
    	$content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
    		'invoice'       => $invoice,
    		'email_type'    => $email_type,
    		'email_heading' => $email_heading,
    		'sent_to_admin' => false,
    		'plain_text'    => false,
    		'message_body'  => $message_body,
    	) );
    
    	return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
    }
    

    This will send another email with the same content to given recipient addresses. Don’t forget to change the email address from ‘abc@mycompany.com, xyz@mycompany.com‘ to your email addresses. You can add a comma-separated list of email addresses. Let me know if it helps or not.

    Regards,
    Patrik

Viewing 3 posts - 1 through 3 (of 3 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket