• I am trying to get a contact form to send to multiple recipients BUT I want each email to appear as a separate email to each recipient, and not as one email to all recipients.

    I am trying to send multiple requests to separate users, but the emails need to be between the sender of the form and each separate recipient (the reason why the form must send multiple emails at once)

    I have tried setting multiple BCC recipients, but I’d prefer to not have it appear in Spam.

    Is there a hook I can use so that if I specify multiple recipients, that it sends multiple emails from the one contact form?

Viewing 1 replies (of 1 total)
  • I would explore one of the cf7 hooks, such as the wpcf7_mail_sent which is an action fired once the mail notification has been successfully sent,

    
    // define the wpcf7_mail_sent callback?
    function action_wpcf7_mail_sent( $contact_form ) {?
        //the $contact_form is a WPCF7_ContactForm Object
    ?   // this object contains all the data submitted from your form front end
        // including the email message fields which you can reuse for your multiple emails
        //use wp_mail to send your extra mails
    };?
    // add the action?
    add_action( 'wpcf7_mail_sent', 'action_wpcf7_mail_sent', 10, 1 );
    

    you can follow this tutorial to understand how to use the WPCF7_ContactForm Object and extract the relevant information that you need.

    You would need to either hard-code your additional email recipients in your function, or else add them as hidden fields in your cf7 form which you could extract from the cf7 object.

    You can then use the wp_mail function to send your additional emails.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Send multiple emails from one contact form’ is closed to new replies.