views:

716

answers:

2

I have uploaded a working Cakephp web application to Mosso Cloud Sites hosting. The application is working fine except that emails are no longer being delivered. The site is an exact copy from my previous host, where sending email was working correctly. The app uses the built in Cakephp email component. I have searched Mosso's knowledgebase and followed the directions for php email (htaccess method) here. My script is as follows:

    $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();
+1  A: 

I would post a comment but don't have the reputations yet..

Anyway, did you check the send() return value? Do you get any errors in your log files? If there are no errors and the return value is fine, you should probably contact the support of your host.

dr Hannibal Lecter
A: 

After discussing the issue with the Mosso staff at length one of their linux admins stepped in and after reviewing the code noted that the Mosso Cloud Sites email system does NOT support Bcc or Cc on code generated emails. So since my code was using Bcc to send a copy to our staff as well as to the customer my emails were not being sent and no PHP errors were being thrown.

So if you use Mosso Cloud sites you cannot send emails with Bcc or Cc from code. Lesson learned, but something that should be easier to find in their knowledge base.

Shane