L
L
ligisayan2017-03-31 11:39:14
Email
ligisayan, 2017-03-31 11:39:14

How to set up forwarding emails to different mailboxes in wordpress depending on the selected item?

Hello! There is a site on wordpress , where I want to implement a feedback form with the ability to select the type of appeal, so that, depending on the type chosen, the message is sent to the appropriate mailbox and statistics are saved in the personal account.
c68eb186c7f9413ca0541765aeb2b203.jpg
How can this be implemented? Perhaps there is a ready-made functionality in some plugin for these purposes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2017-03-31
@ligisayan

Hello.
About ready and convenient I do not know. And so, Contact Form 7 + Flamingo.
To change the email, I remember using the wpcf7_before_send_mail hook.
Something like this:

add_action('wpcf7_before_send_mail', 'dco_wpcf7_before_send_mail');

function dco_wpcf7_before_send_mail($contact_form) {
    $submission = WPCF7_Submission::get_instance();
    $data = & $submission->get_posted_data();
    $subject = $data['your-subject'];

    if ($subject == 'Директор') {
        $mail = $contact_form->prop('mail');
        $mail['recipient'] = '[email protected]';
        $contact_form->set_properties(array('mail' => $mail));
    }

    if($subject == 'Менеджер') {
        $mail = $contact_form->prop('mail');
        $mail['recipient'] = '[email protected]';
        $contact_form->set_properties(array('mail' => $mail));
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question