eZ Community » Forums » Setup & design » Missing EmailSender in Email Headers

Missing EmailSender in Email Headers

Missing EmailSender in Email Headers

Thursday 04 September 2003 6:00:32 pm - 5 replies

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)

Friday 05 September 2003 12:00:33 pm

Hi Paolo

I did this by making the following changes to
(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

Friday 05 September 2003 2:44:16 pm

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"blunk.gif Emoticon 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)

Friday 05 September 2003 7:52:01 pm

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.

Tuesday 20 April 2004 9:20:24 am

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

Blind copy:

$mail->addBcc( $receiver );


$mail->addCc( $receiver );

Best Regards,

Christian Lundvang
Nexus Consulting as

Monday 26 March 2012 2:13:54 pm




//$emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
$emailSender = $tpl->variable( 'email_sender' );
if ( !$emailSender )
      $emailSender = $ini->variable( "MailSettings", "AdminEmail" );




You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from