Home › Toolset Professional Support › [Resolved] Setting From et Reply-To fields with CRED
Problem:
How to add "Reply To" in CRED email header.
Solution:
With CRED 1.5.2, we have added new filter "cred_mail_header" using which you can add header elements to your CRED emails.
You can find proposed solution on the following reply:
https://toolset.com/forums/topic/setting-from-et-reply-to-fields-with-cred/#post-380580
Relevant Documentation:
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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)
Tagged: Toolset Forms
This topic contains 15 replies, has 2 voices.
Last updated by volodiaB 8 years ago.
Assisted by: Minesh.
Hi Support Team!
I am using the plugins Types and CRED (with notifications) to create contact forms.
On the contact form, the visitor is asked to enter its email address (see hidden link). Can you let me know how I can use this field so that when my client click on the "reply" button of their webmail they actually reply to the visitor (and not to wordpress@k1ss.brussels)? See print screen.
Thank you,
Volodia
Hello. Thank you for contacting the Toolset support.
There is no such feature available for now but you have a point indeed and I'll file a new feature request for this and I'll keep you posted here as soon as I know more.
Hi Minesh,
Thanks for your reply. I indeed think that it could be an interesting feature to have and I don't think that it is much work to implement it.
Regards,
Volodia
I've re-opened this thread as I've good news for you. Our developers did a great job to offer you the solution.
Could you please share your CRED form URL?
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Hi Minesh,
That's a great news that you bring me here!
Would it be possible for you to guide me through the steps so I can do it myself and replicate the process to other sites?
Thanks a lot,
Volodia
We have added new filter to CRED: "cred_mail_header"
Using which you can set your Header parameters.
add_filter('cred_mail_header', 'add_my_header', 10, 3); function add_my_header($headers, $formid, $postid,$notification_counter = 0) { If($formid === xxx) { $myheaders = array( 'Reply-To: xxx@gmail.com' ); return array_merge($headers, $myheaders); } }
You can bind this using $formid and $notification_counter is your notification counter, by default it starts with 0. So for example if you add first notification it will be 0, second will be 1 and so on.
I need to upload updated updated files on your install. Could you please send me access details.
Hi Minesh,
It seems to be an elegant solution. Though the website I am willing to make this change first is already in prod and I would rather prefer to be the only one making change on it.
Do you have an idea when this upgrade of the CRED plugin will be officially released?
Regards,
Volo
PS: if this is absolutely needed, I can upload a beta version of the site on a separate web host but since I can wait some time to have this new feature available, I don't think it is necessary to invest further in a temporary fix
I just got the news that we are going to release new CRED version by this week.
I'll keep you posted here.
Great!
Could you please update CRED to latest official release 1.5.2 and try to resolve your issue.
Hi Minesh,
I did update CRED to version 1.5.2 and set the following short codes of the form for the "From details":
- Email : [types field="email"][/types]
- Name : [types field="nom"][/types]
but it is still not working (see also screenshots).
Can you have a look and let me know if the changes I made are the one I am suppose to do?
Regards,
Volodia
No - you can not use shortcode in the field of email and name.
You need to add following filter to your functions.php file to set "Reply-To" or any other header options.
add_filter('cred_mail_header', 'add_my_header', 10, 3); function add_my_header($headers, $formid, $postid,$notification_counter = 0) { If($formid === xxx) { $myheaders = array( 'Reply-To: xxx@gmail.com' ); return array_merge($headers, $myheaders); } }
ou can bind this using $formid and $notification_counter is your notification counter, by default it starts with 0. So for example if you add first notification it will be 0, second will be 1 and so on.
Hi Minesh, thanks for your reply.
Though I am not sure to understand how this will enable to dynamically set the header with the email address filled in by the user.
As a reminder, I am willing to be able to reply to the visitor of my site sending me an email via the contact form (using CRED) by clicking on the reply button of my email platform.
Not sure if it is clear?
Regards,
Volodia
Yes - it's clear.
Following line will set the "Reply-To" header for your email. Where you should replace "xxx@gmail.com" with your email.
$myheaders = array( 'Reply-To: xxx@gmail.com' );
Now, if you have dynamic email then as you see the function "add_my_header" it also have parameter $post_id.
So - using $post_id you can query and get any data you want stored in database. So you should use $post_id and get data from database table as you desired and replace "xxx@gmail.com" with your email which is stored in database.
Hope this is clear now.
Hello Minesh, thanks for the precision.
I'll try this solution. Still need to look up how to get the email field using $post_id.
Regards,
Volodia