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 ([email protected]) specified in the collectedinfomail.tpl:

{set-block scope=root variable=email_sender}[email protected]{/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 [email protected].

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.