Forums / Setup & design / How to set reply-to address in contact forms?

How to set reply-to address in contact forms?

Author Message

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

Horst Lindlbauer

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.

---------------------------------------
http://www.lbm-services.de

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.

Horst Lindlbauer

Tuesday 02 February 2010 1:20:48 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.

"

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}

---------------------------------------
http://www.lbm-services.de

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

Duffy Walsh

eZ debug

Timing: Jan 18 2025 01:03:11
Script start
Timing: Jan 18 2025 01:03:11
Module start 'content'
Timing: Jan 18 2025 01:03:12
Module end 'content'
Timing: Jan 18 2025 01:03:12
Script end

Main resources:

Total runtime1.0692 sec
Peak memory usage4,096.0000 KB
Database Queries207

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0109 587.8438180.8125
Module start 'content' 0.01090.9223 768.6563679.0547
Module end 'content' 0.93320.1359 1,447.7109341.0547
Script end 1.0691  1,788.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3761210.0002
Check MTime0.00150.1378210.0001
Mysql Total
Database connection0.00070.067610.0007
Mysqli_queries0.975891.26472070.0047
Looping result0.00220.20222050.0000
Template Total1.028296.220.5141
Template load0.00200.188920.0010
Template processing1.026295.980620.5131
Template load and register function0.00020.018510.0002
states
state_id_array0.00160.149310.0016
state_identifier_array0.00180.165620.0009
Override
Cache load0.00180.1699590.0000
Sytem overhead
Fetch class attribute can translate value0.00130.118350.0003
Fetch class attribute name0.00130.117880.0002
XML
Image XML parsing0.00250.235150.0005
class_abstraction
Instantiating content class attribute0.00000.003080.0000
General
dbfile0.00600.5616350.0002
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
19content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
11content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 49
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs