This hook is run before a notification email is sent. It can be used as an alternative to the hook quform_pre_send_notification when using an email sending plugin that does not use PHPMailer.
quform_notification_mailer_config_X_X
This hook is run for a single notification.
Example
12
3
4
5
6
7
| add_filter('quform_notification_mailer_config_1_1', function (array $config, Quform_Notification $notification, Quform_Form $form) { if ($form->getValue('quform_1_3') == 'Sales') { $config['to'][] = 'sales@example.com'; } return $config; }, 10, 3); |
add_filter('quform_notification_mailer_config_1_1', function (array $config, Quform_Notification $notification, Quform_Form $form) { if ($form->getValue('quform_1_3') == 'Sales') { $config['to'][] = 'sales@example.com'; } return $config; }, 10, 3);
- On line 1, replace the
1_1
with the notification unique ID
1
2
3
4
5
6
7
8
9 | function my_notification_mailer_config(array $config, Quform_Notification $notification, Quform_Form $form) { if ($form->getValue('quform_1_3') == 'Sales') { $config['to'][] = 'sales@example.com'; } return $config; } add_filter('quform_notification_mailer_config_1_1', 'my_notification_mailer_config', 10, 3); |
function my_notification_mailer_config(array $config, Quform_Notification $notification, Quform_Form $form) { if ($form->getValue('quform_1_3') == 'Sales') { $config['to'][] = 'sales@example.com'; } return $config; } add_filter('quform_notification_mailer_config_1_1', 'my_notification_mailer_config', 10, 3);
- On line 9, replace the
1_1
with the notification unique ID
quform_notification_mailer_config
This hook is run for all notifications.
Example
1 2 3 4 5 6 7 | add_filter('quform_notification_mailer_config', function (array $config, Quform_Notification $notification, Quform_Form $form) { if (is_user_logged_in()) { $config['headers'][] = 'X-Priority: 1'; } return $config; }, 10, 3); |
add_filter('quform_notification_mailer_config', function (array $config, Quform_Notification $notification, Quform_Form $form) { if (is_user_logged_in()) { $config['headers'][] = 'X-Priority: 1'; } return $config; }, 10, 3);
1 2 3 4 5 6 7 8 9 | function my_notification_mailer_config(array $config, Quform_Notification $notification, Quform_Form $form) { if (is_user_logged_in()) { $config['headers'][] = 'X-Priority: 1'; } return $config; } add_filter('quform_notification_mailer_config', 'my_notification_mailer_config', 10, 3); |
function my_notification_mailer_config(array $config, Quform_Notification $notification, Quform_Form $form) { if (is_user_logged_in()) { $config['headers'][] = 'X-Priority: 1'; } return $config; } add_filter('quform_notification_mailer_config', 'my_notification_mailer_config', 10, 3);
Parameters
$config
–array
– the mailer configuration$notification
–Quform_Notification
– the notification instance$form
–Quform_Form
– the form instance