我已将一个正常工作的 Cakephp Web 应用程序上传到 Mosso Cloud Sites 托管。该应用程序运行良好,只是不再发送电子邮件。该站点是我以前的主机的精确副本,发送电子邮件工作正常。该应用程序使用内置的 Cakephp 电子邮件组件。我搜索了 Mosso 的知识库并按照此处的 php 电子邮件(htaccess 方法)的说明进行操作。我的脚本如下:
$this->Email->reset();
$this->Email->sendAs = 'html'; // both = html + plain text
$this->Email->to = '"'.$data['Customer']['first_name'].' '.$data['Customer']['last_name'].'" <' . $data['Customer']['email']. '>';
$this->Email->bcc = $this->_generateRecipients($data['Booking']['sales_associate_id']);
$this->Email->from = '<noreply@'.env('HTTP_HOST').'>';
$this->Email->replyTo = '<noreply@'.env('HTTP_HOST').'>';
$this->Email->return = '<noreply@'.env('HTTP_HOST').'>';
$this->Email->subject = 'Rental Receipt';
// Select appropraite email template
switch ($this->Session->read('site_id')) {
case '100':
$this->Email->template = 'vac_receipt1';
break;
case '200':
$this->Email->template = 'vac_receipt2';
break;
}
$this->Email->send();