我正在尝试使用 CakePHP 2.0 发送一封带有附件的电子邮件。
该文件由用户通过表单提交。
到目前为止我有:
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail();
$email->attachments = array($this->data['Opportunity']['resume_file']['tmp_name']);
$email->viewVars(array('name' => $this->data['Opportunity']['name']));
$email->template('application')
->emailFormat('html')
->to(TEST_CONTACT)
->from(EMAIL_CONTACT)
->subject('New application received')
->send();
电子邮件已发送,看起来不错,但没有附件。
我究竟做错了什么?
由于某种原因,CakePHP 不会执行附件,除非您声明
首先是文件路径。
我有同样的问题,但我没有找到很多答案
这个问题。我花了一段时间才解决这个问题,澄清,
我让它工作了
$this->Email->filePaths = array('/home/username/');
$this->Email->attachments =array('article_button.png');
$this->Email->to = '[email protected]';
$this->Email->subject = 'Something';
$this->Email->replyTo = $client['Client']['email'];
$this->Email->from = $client['Client']['email'];
$this->Email->sendAs = 'html';
if($this->Email->send('Testing', null, null)){
die('Email Sent!');
}else{
die('Failed to send email');
}
http://groups.google.com/group/cake-php/browse_thread/thread/93a9c9467733fe38?pli=1
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)