Tuesday, August 7, 2012

Send Email using Shell in CakePHP

 I write a Shell for sending email like this :

<?php
class SendMailShell extends Shell {
    function main() {
        App::import('Core', array('Controller'));
        App::import('Component', array('Email'));
        $this->Controller =& new Controller();
        $this->Email =& new EmailComponent();
        $this->Email->startup($this->Controller);
        $this->Email->reset();
        $this->Email->to = 'Jonny <Jonny@unita.net>';
        $this->Email->subject = "Subject";
        $this->Email->from = "Jonny@unita.net";
        $this->Email->template = 'default';
        $this->Email->sendAs = "html";
        $this->Email->send();
    }
}
?>

---- Program execute successfully, but Email do not send to Jonny@unita.net.
     I research and do like some guild line in internet but not done.
     Please help me!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: