• Resolved ektrunks

    (@ektrunks)


    Hey I’ve used your filter function to send out email notifications to myself and it works great. I searched through the database to see if this has been answered and couldn’t find it.

    I have multiple forms on my site and need to be notified when they’re filled out. Is there a way to use the filter function to set a different email subject line for each different form?

    This is the filter function I’m referencing:

    `add_action( ‘yikes-mailchimp-form-submission’, ‘yikes_send_email_after_submission’, 10, 4 );

    function yikes_send_email_after_submission( $email, $merge_variables, $form_id, $notifications ) {

    $interface = yikes_easy_mailchimp_extender_get_form_interface();
    $form_data = $interface->get_form( $form_id );
    $form_name = $form_data[‘form_name’];
    $content = ‘<p>MailChimp Submission for Form: ‘ . $form_name . ‘</p>’;
    $content .= ‘<p>A user with the email ‘ . $email . ‘ has attempted to subscribe to your MailChimp list.</p>’;
    $content .= ‘<p>Here is their information: </p><br>’;
    foreach ( $merge_variables as $merge_tag => $merge_value ) {
    $content .= ‘<p>’ . $merge_tag . ‘: ‘ . $merge_value . ‘</p>’;
    }
    $admin_email = ‘ENTER YOUR EMAIL HERE!’; // e.g. ‘[email protected]
    $subject = ‘New MailChimp Submission for Form: ‘ . $form_name;
    $headers = array( ‘Content-Type: text/html; charset=UTF-8′ );

    wp_mail( $admin_email, $subject, $content, $headers );
    }’

    Thanks in advance!

    Kyle

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @ektrunks,

    I might be confused here, but the code you’re referencing does set a different subject for each form. It uses the $form_name variable here:

    $subject = ‘New MailChimp Submission for Form: ‘ . $form_name;

    Is that not showing what you expect it to?

    Thanks,
    Jon

    Thread Starter ektrunks

    (@ektrunks)

    Thanks for your reply and I will sheepishly admit, that I messed that up because I edited it when I first added it to my site. So as I looked through I didn’t realize the original had the variables in it.

    Thanks for your help, especially when it was right in front of me!

    Kyle

    Hey @ektrunks,

    No worries! Happens all the time ??

    Thanks,
    Jon

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Submission Notification Emails’ is closed to new replies.