Skip Navigation

[Resolved] How to replace to field in cred notification

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#524933

I am trying to:

send notification to dynamic email address with customer phone from the form. In example to 07905487@sms.clicksend.com. The number 07905487 (phone)must be taken from field (cust-phone) in the form submitted.

I visited this URL:

I've added this to functions

function customise_cred_notifications( $post_id, $headers, $formid, $postid, $notification_name, $notification_number ) {
if ($formid==2867 && $notification_number==2) {
$myheaders = array();
$myuser = get_post_meta($post_id, 'cust-phone', true);
$myheaders = array( 'CC: ' .$myuser. '@sms.clicksend.com' );
return array_merge($headers, $myheaders);
}
}
add_filter('cred_mail_header', 'customise_cred_notifications', 10, 5);

I expected to see:

value from cust-phone added to CC of the email.

Instead, I got:

Nothing - not even CC: @sms.clicksend.com. Email is just sent to wordpress user (Send notification to a WordPress user:) without CC.
If I replace ' .$myuser. '@sms.clicksend.com' with email address - CC is sent to this email. Please help.

#525126

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I believe field "cust-phone" is created using Types - correct? If yes: Types field uses prefix "wpcf-" for each custom field.

Could you please try to use following line of code:

function customise_cred_notifications( $post_id, $headers, $formid, $postid, $notification_name, $notification_number ) {
if ($formid==2867 && $notification_number==2) {
$myheaders = array();
$myuser = get_post_meta($post_id, 'wpcf-cust-phone', true);
$myheaders = array( 'CC: ' .$myuser. '@sms.clicksend.com' );
return array_merge($headers, $myheaders);
}
}
add_filter('cred_mail_header', 'customise_cred_notifications', 10, 5);
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.