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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 01:02:49
Script start
Timing: Jan 30 2025 01:02:49
Module start 'layout'
Timing: Jan 30 2025 01:02:49
Module start 'content'
Timing: Jan 30 2025 01:02:49
Module end 'content'
Timing: Jan 30 2025 01:02:49
Script end

Main resources:

Total runtime0.0152 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.2656151.2266
Module start 'layout' 0.00480.0023 739.492236.6797
Module start 'content' 0.00710.0066 776.171998.8281
Module end 'content' 0.01380.0014 875.000041.9922
Script end 0.0151  916.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002315.2118140.0002
Check MTime0.00106.7875140.0001
Mysql Total
Database connection0.00074.809910.0007
Mysqli_queries0.001912.843030.0006
Looping result0.00000.066010.0000
Template Total0.00106.910.0010
Template load0.00085.447610.0008
Template processing0.00021.369810.0002
Override
Cache load0.00063.972610.0006
General
dbfile0.002214.611880.0003
String conversion0.00000.033040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs