我正在努力发送带有附件的电子邮件。我正在使用 php 默认配置来发送电子邮件,但使用的是 CakePHP 框架。
$fromEmail = $from_name." <".$from_email.">";
$this->Email->from = $fromEmail;
$this->Email->to = trim($email);
$this->Email->subject = $subjects[$this->params['action']];
$this->Email->sendAs = 'text';
$this->Email->template = $this->params['action'];
print_r($attachments); exit; // Gave me an empty Array ( )
$this->Email->attachments = $attachments;
$attachments = array( );
if ( ! empty($this->data['Submit']['files'])) {
$attach_files = $this->Document->DocumentDocument->find('all', array(
'conditions' => array(
'MailDocument.Mail_id' => $this->data['Submit']['prop_id'],
'MailDocument.id' => $this->data['Submit']['files'],
),
));
$attachments = Set::combine($attach_files, '/PropertyDocument/file', '/PropertyDocument/file_path');
}
我知道我们必须在 cakePHP 中定义文件路径。
我哪里错了?