Forums / Setup & design / How to set reply-to address in contact forms?
Horst Lindlbauer
Sunday 03 May 2009 4:45:21 am
I found this: http://ez.no/developer/forum/setup_design/cc_in_contact_forms and wonder how to set the reply-to-address for mails sent by contact form.I tried in vain :
{append-block scope=root variable=email_replyto}{$collection.data_map.email.content}{/append-block} {append-block scope=root variable=email_reply_to_receiver}{$collection.data_map.email.content}{/append-block}
Why is there no documentation for such a basic thing?
--------------------------------------- http://www.lbm-services.de
Christian Rößler
Sunday 03 May 2009 11:23:43 am
As far as i know, there is no such variable.If you need such thing (besides email_receiver, email_cc_receivers, email_bcc_receivers, ...) you'll need to hack the file:
kernel/content/collectedinformation.php
at line 295 i think:
$mail->setSender( $sender ); $mail->setReplyTo( $sender );
I gave up a few weeks ago searching for this. Using an extension to avoid hacking the kernel seems not possible. you'll not be update-save.
Hannover, Germany eZ-Certified http://auth.ez.no/certification/verify/395613
Monday 04 May 2009 10:20:53 am
Thank you so much for your hint.It's hard to believe that this is a desired feature up to now ... it's v.4.1 after all!
The piece of code to implement is as simple as this:Around line 275
$replyto = $tpl->variable( 'email_replyto' );
After line 295
if ( $mail->validate( $replyto ) ) { $mail->setReplyTo( $replyto ); } else { $mail->setReplyTo( $sender ); }
Then the replyto-address can be set to user's email and returned by template:
{set-block scope=root variable=email_replyto}{$collection.data_map.email.content}{/set-block}
@ez-devs: Please implement to v.4.1.x ! Thank you.
Quoc Huy Nguyen Dinh
Thursday 08 October 2009 3:51:28 pm
Actually you can do this in a template.extension/ezwebin/design/ezwebin/templates/content/collectedinfomail/form.tpl
Right after the {foreach... line add this:
{if $attribute.contentclass_attribute.identifier|eq('email')}{section show=$attribute|get_class|eq( 'ezinformationcollectionattribute' )}{set-block scope=root variable=email_sender}{$:attribute.data_text|wash}{/set-block}{/section}{/if}
The sender and reply-to will be set to the 'email' attribute from the feedback form.
Tuesday 02 February 2010 1:20:48 pm
Yes, but the problem was to set the reply-to-adresse to a DIFFERENT address than the sender (e.g. in case the sender has to be your own email address to be delivered by your provider's mail server ...)
UPDATE: the ez guys did their homework: with v.4.2 you don't have to hack the kernel anymore !
To set the reply-to-address simply add to your template this:
{set-block scope=root variable=email_reply_to}{$collection.data_map.email.content}{/set-block}
Duffy Walsh
Tuesday 18 January 2011 11:00:32 am
Is there any other configuration necessary to use:
<span>{</span><a href="http://doc.ez.no/set-block" mce_href="http://doc.ez.no/set-block" target="ez_no_documentation"><span>set-block</span></a> <span>scope</span><span>=</span>root <span>variable</span><span>=</span>email_reply_to<span>}</span><span>{</span><span>$collection</span>.<span>data_map</span>.<span>email</span>.<span>content</span><span>}</span><span>{</span><span>/</span><a href="http://doc.ez.no/set-block" mce_href="http://doc.ez.no/set-block" target="ez_no_documentation"><span>set-block</span></a><span>}</span>
I have tried removing the email sender value from the site.ini override and added a static test value between the set-block email_reply_to tags as well, but i'm not having any luck.
For testing in collectedinfomail/content/form.tpl I have used the following set-block
{set-block scope=root variable=email_reply_to}testof@setblock.com{/set-block}
And I tried using the value testof@setblock.com with and without quotes.
UPDATE: WORKING NOW
I'm not sure what fixed it. I tried adding EmailReplyTo in Mail settings with a blank value and it worked, then removed that line and tried it again and it's still working so I'm not sure what was wrong. But thanks for the addition