Missing EmailSender in Email Headers

Author Message

PaoloMellerio kk

Thursday 04 September 2003 9:00:32 am

Hi,
I've created a form for informations request.
In it, among the others, there is a field "Email_sender" (defined as information collector in the class used for the form).
All works fine, except the fact that I can't find the way to show the field "Email_sender" (filled by the user, while compiling the form) also in the Email Headers "FROM:".
In others words, the email which arrives, due to the form compiling, shows the content of the field "Email_sender" in the Email Header Subject, together all the other fields filled by user in the form, but not in the Email Headers Sender.
Is there a way to modify the file collectedinfomail.tpl or another way to solve this problem?

Thanks in Advice

Paolo Mellerio (Clikka!com)

Paolo Mellerio
http://www.clikka.com

John Green

Friday 05 September 2003 3:00:33 am

Hi Paolo

I did this by making the following changes to
/kernel/content/collectinformation.php
(my added lines marked)

$subject =& $tpl->variable( 'subject' );
$receiver =& $tpl->variable( 'email_receiver' );
>>>> $sender =& $tpl->variable( 'email_sender' );
$redirectToNodeID =& $tpl->variable( 'redirect_to_node_id' );

$ini =& eZINI::instance();
$mail = new eZMail();

if ( !$mail->validate( $receiver ) )
{
// receiver does not contain a valid email address, get the default one
$receiver = $ini->variable( "InformationCollectionSettings", "EmailReceiver" );
}
$mail->setReceiver( $receiver );
>>>> if ( !$mail->validate( $sender ) )
>>>> {
>>>> // sender does not contain a valid email address, get the default one
>>>> $sender = $ini->variable( "InformationCollectionSettings", "EmailSender" );
>>>> }
>>>>
>>>> $mail->setSender( $sender );
$mail->setSubject( $subject );
$mail->setBody( $templateResult );
$mailResult = eZMailTransport::send( $mail );

Replace 'email_sender' with whatever name you used in the set-block in collectedinfomail.tpl

Good luck

PaoloMellerio kk

Friday 05 September 2003 5:44:16 am

Thanks John,
I've followed your suggestion, and now the email arrives with the correct email header (paolo@clikka.com) specified in the collectedinfomail.tpl:

{set-block scope=root variable=email_sender}paolo@clikka.com{/set-block}

The following step would be to find a way to modify the lines above of the collectedinfomail.tpl to read the email inserted from the user while compiling the form (in the form field "Email_sender") and to have it directly transferred in the Email Headers "FROM:" replacing the "static" value paolo@clikka.com.

Any idea?

Thanks again.

Paolo Mellerio (Clikka!com)

Paolo Mellerio
http://www.clikka.com

Graham Tillotson

Friday 05 September 2003 10:52:01 am

This works great -- thanks much. In my case I substituted the following line in collectedinfomail.tpl:

{set-block scope=root variable=email_sender}{$object.data_map.email_sender.content}{/set-block}

If I have an email address (email_sender) in the form data then I use it. If not, I pick up the default one from the InformationCollectionSettings block.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com

Christian Lundvang

Tuesday 20 April 2004 12:20:24 am

If you want to send a copy or a blind copy use the following:

Blind copy:

$mail->addBcc( $receiver );


Copy:

$mail->addCc( $receiver );

Best Regards,

Christian Lundvang
Nexus Consulting as

--
Best Regards
Christian Lundvang
http://www.nxc.no

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 18 2025 19:18:23
Script start
Timing: Jan 18 2025 19:18:23
Module start 'layout'
Timing: Jan 18 2025 19:18:23
Module start 'content'
Timing: Jan 18 2025 19:18:23
Module end 'content'
Timing: Jan 18 2025 19:18:23
Script end

Main resources:

Total runtime0.0158 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.0058 588.0313152.6406
Module start 'layout' 0.00580.0028 740.671939.4766
Module start 'content' 0.00860.0052 780.148497.4609
Module end 'content' 0.01380.0020 877.609438.3047
Script end 0.0158  915.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002616.4877140.0002
Check MTime0.00117.0636140.0001
Mysql Total
Database connection0.00106.090410.0010
Mysqli_queries0.002616.231630.0009
Looping result0.00000.076810.0000
Template Total0.00149.010.0014
Template load0.00085.313110.0008
Template processing0.00063.645510.0006
Override
Cache load0.00063.720810.0006
General
dbfile0.00116.635780.0001
String conversion0.00000.039240.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