How to use ezmail to send email?

Author Message

Bill Smith

Wednesday 03 January 2007 4:15:46 am

I searched the previous posts, and find

$mail = new eZMail();
$mail->setReceiver( '[email protected]' );
$mail->setSender( '[email protected]' );
$mail->setSubject( 'A nice subject' );
$mail->setBody( 'Here we go' );
$mailResult = eZMailTransport::send( $mail );

but seems it doesn't work

Then I go through the codes of forgotpassword, and try, found that this code works

        $mail = new eZMail();
        $tpl =& templateInit();
        $templateResult =& $tpl->fetch( 'design:user/forgotpasswordmail.tpl' );
        $mail->setSender( $emailSender );
        $mail->setReceiver( $receiver );
        $mail->setSubject( $subject );
        $mail->setBody( $templateResult );
        $mailResult = eZMailTransport::send( $mail );

maybe the body of the email must be fetched from another template?

I am not sure, but when I design a new template, and fetch this template to send email

it doesn't work again. Anyone can tell me how to send the customized mail with

ezPublish? Thanks very much. or can introduce some article on how to send ezmail.

I search the forum, but fail to find. =(

Mingxing Chen

Thursday 04 January 2007 8:25:48 am

Hi Bill,

include_once( 'kernel/classes/ezcontentobject.php' );
include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
include_once( 'kernel/classes/ezcontentbrowse.php' );
include_once( 'kernel/classes/ezcontentbrowsebookmark.php' );
include_once( 'kernel/classes/ezcontentclass.php' );
include_once( "lib/ezdb/classes/ezdb.php" );
include_once( "lib/ezutils/classes/ezhttptool.php" );
include_once( "lib/ezutils/classes/ezini.php" );
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
include_once( 'lib/ezutils/classes/ezmail.php' );
include_once( 'lib/ezutils/classes/ezmailtransport.php' );

Are they useful?
best wishes.

Shinetech is the leader in next generation global application outsourcing. Shinetech combines world class technical skills, recognized expertise in advanced development methodologies and industry experience to deliver results for global enterprises. Shinetech utilizes distributed Agile methods for rapid and precise systems development.
------------------------------------------------------------------------------------------
Blog: http://www.mingxing.me
Email: [email protected]

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