Friday, April 3, 2009

Re: Need Help of Email component - fail to send email

After struggle with email component source code, you should write the right format for Email->to and Email->from. Like below:
$this->Email->smtpOptions = array(
            'port' => '465',
            'timeout' => '30',
            'host' => 'ssl://smtp.gmail.com',
            'username' => 'xxxxx@gmail.com',
            'password' => 'password');
        $this->Email->delivery = 'smtp';
        //$this->Email->to = $user['email'];
        $this->Email->to = 'Sir.B <yyyyy@gmail.com>';
        $this->Email->subject = 'Fuck!!!!';
        $this->Email->replyTo = 'support@example.com';
        $this->Email->from = 'Sir.A <xxxxx@gmail.com>';
But I didn't find any doc explain this. Stupid format. Why not an array?
Give an example of phpmailer
//code
 public function AddReplyTo($address, $name = '') {
    $cur = count($this->ReplyTo);
    $this->ReplyTo[$cur][0] = trim($address);
    $this->ReplyTo[$cur][1] = $name;
  }
//end
And we write this configure like this:
//code
var $from         = 'xxxx@gmail.com';
var $fromName     = "Sir.A";
//end

On Sat, Apr 4, 2009 at 9:56 AM, joshua <joshokn@gmail.com> wrote:
Any one can give an example configure if you have succeed on this?

On Fri, Apr 3, 2009 at 11:42 PM, joshua <joshokn@gmail.com> wrote:
I try every way that I can find to send email from my gmail account or yahoo account , but both of them are failed. I use cake Email component to send.
###################################################
$this->Email->smtpOptions = array(
            'port' => '25',//for gmail 465
            'timeout' => '30',
            'host' => 'smtp.yahoo.com', // for gmail ssl://smtp.gmail.com
            'username' => 'xxx@yahoo.com', //xxx@gmail.com
            'password' => 'xxxxxxx');
        $this->Email->delivery = 'smtp';
        $this->Email->to = 'yyyyyy@hotmail.com';// or 'yyyyy@gmail.com'
        $this->Email->subject = 'Thanks';
        $this->Email->replyTo = 'support@example.com';
        $this->Email->from = 'Example <noreply@example.com>';
        $this->Email->template = 'simple'; // note no '.ctp'
        $result = $this->Email->send();
        debug($this->Email->smtpError);
###################################################

--
Thanks
Joshua



--
Thanks
Joshua



--
Thanks
Joshua

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: