我正在尝试用 PHP 发送邮件。下面给出了我用于在CakePHP中发送邮件的代码。我在网页中收到“简单电子邮件已发送”消息,但邮件未发送到我的收件箱。我错过了什么吗?
和字段to
中的值使用在用户界面中输入的值进行设置。subject
link
$this->set('to',$this->params['form']['to']);
$this->set('subject',$this->params['form']['subject']);
$this->set('link',$this->params['form']['link']);
$this->Email->to = to;
$this->Email->subject = subject;
$this->Email->from = 'someperson@somedomain.com';
$this->Email->delivery= 'mail';
$this->Email->sendAs='text';
$this->Email->template = 'simple_message';
//$this->Email->send(link);
if ( $this->Email->send(link) ) {
$this->Session->setFlash('Simple email sent');
} else {
$this->Session->setFlash('Simple email not sent');
}