开发者

Trying to get test email working in cakephp

I'm trying to use the "Sending a basic message" code from here to send an email: http://book.cakephp.org/view/1283/Email#!/view/1286/Sending-a-basic-message

The code appears to work but I never receive the email (I've verified that the email address is valid). I haven't configured an email server anywhere in PHP, but the instructions make no mention of that. Here's the output when I set

 $this->Email->delivery = 'debug';

.

To: Somebody Else 
From: Somebody 
Subject: Test
Header:

From: Somebody  
Message-ID: <4daa65cd-beb8-4bf6-8cec-1dc07b5e5e4c@localhost>
Date: Sat, 16 Apr 2011 22:00:13 -0600
X-Mailer: CakePHP Email Component
Content-Type: text/plain; charset=UTF开发者_StackOverflow中文版-8
Content-Transfer-Encoding: 7bitParameters:

Message:

Hello message body!


opike,

if you use the debug setting, then you are not sending an email, but rather displaying it. See here.

For a proper setup, see here. So you do not need a MTA like exim or sendmail configured, but rather use your ISP (aka (here), your normal email address) to do the work.

Edit0: And you definitly set it up like the book dictates?:

   /* SMTP Options, !with the settings of your ISP substituted in! */
   $this->Email->smtpOptions = array(
        'port'=>'465', 
        'timeout'=>'30',
        'host' => 'ssl://smtp.gmail.com',
        'username'=>'your_username@gmail.com',
        'password'=>'your_gmail_password',
   );


Try running the phpinfo() function in a file of its own and look to see if you're PHP installation is using something like sendmail. Most likely, you don't have an SMTP server installed or it's not properly configured in your php.ini file.

Is there anything (error) in the PHP logs?

<?php

phpinfo();

?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜