Saturday 28 May 2011 2:43:54 pm - 4 replies
Modified on Saturday 28 May 2011 2:46:26 pm by David Santiso
Sao Tavi
Saturday 28 May 2011 3:23:55 pm
Maybe
$Tpl->setVariable( 'name', 'David' );
before
$templateResult = $Tpl->fetch( 'design:info_email.tpl' );
David Santiso
Saturday 28 May 2011 3:50:27 pm
I tried to display the template without sending mail and it displays the contents of variables, but when I send the mail, it doesn't display them.
Martin Weber
Friday 24 June 2011 8:28:04 am
Your first one can not work:
$mail = new eZMail();$Tpl = eZTemplate::factory();$templateResult = $Tpl->fetch( 'design:info_email.tpl' );$Tpl->setVariable( 'name', 'David' );$subject = 'TEST';$mail->setSender( $emailSender );$mail->setReceiver( 'mymail@mail.com' );$mail->setSubject( $subject );$mail->setBody( $templateResult );$mail->setContentType( 'text/html' );$mailResult = eZMailTransport::send( $mail );
You set the body with the $templateResult. This is returned by fetching the template but you set the variable after fetching.
Regards,Martin
Jerome Despatis
Tuesday 28 June 2011 10:58:04 am
Important thing, eZMail is deprecated, gonna be replaced by ezcomponents (zetacomponents) in the future. Not advised to use it
=> http://ezcomponents.org/docs/tutorials/Mail (you'll find there a working example)
You must be logged in to post messages in this topic!