cakephp电子邮件不工作 [英] cakephp emails not working

查看:129
本文介绍了cakephp电子邮件不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:



var $ components = array('电子邮件');



发送电子邮件的方法如下:

  function send_emails(){
$ this-> Email-> from ='Somebody< somebody@example.com>';
$ this-> Email-> to ='Somebody Else< myspamplace@centrum.cz>';
$ this-> Email-> subject ='Test';
$ this-> Email-> send('Hello message body!');
}

我使用Cake 1.3并使用Apache 2.2.11在localhost上运行它PHP5。



当我把

 

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

在代码中,它显示电子邮件信息,似乎一切正常。



你有什么想法,为什么它不发送电子邮件?

解决方案

您是从Windows服务器发送的吗?如果是,您是否正确设置您的MTA在php ini?您可以使用mail()函式传送邮件吗?



如果您使用的是Windows且需要MTA, hMail 非常适合开发,请注意,许多主机会拒绝来自您本地计算机的邮件的垃圾邮件,所以不要在没有MX记录,域密钥等的生产中使用。


my problem is:

in the controller I have:

var $components = array('Email');

the method to send emails looks like this:

function send_emails() {
  $this->Email->from    = 'Somebody <somebody@example.com>';
  $this->Email->to      = 'Somebody Else <myspamplace@centrum.cz>';
  $this->Email->subject = 'Test';
  $this->Email->send('Hello message body!');
 }

I am using Cake 1.3 and running it on localhost with Apache 2.2.11 and PHP5. Do you guys have any idea why it doesn't work?

When I put

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

in the code, it displays the email info and it seems like everything is ok.

Do you have any ideas what can be the reason why it doesn't send email?

解决方案

Are you sending from a windows server? If so, have you properly setup your MTA in the php ini? Can you send mail using the mail() function?

If you are on windows and need an MTA, hMail is great for development, note that many hosts will reject mail from your local machine a spam so don't use on production without an MX record, domain keys etc.

这篇关于cakephp电子邮件不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆