0

I am using YiiMail to sent emails via a Yii application, I have the following code however no email seems to be sent even though I don't get any form of errors appearing and the extension all appears in the correct location.

Can anyone suggest what I can do next, this is within a function hence the return at the end?

Note - the function returns true indicating it has sent... but I never get an email?? Any ideas why this is?

$message = new YiiMailMessage;
$message->encoder   = Swift_Encoding::get8BitEncoding(); 
$message->view      = 'parentApprovalEmail';
$message->from      = Yii::app()->params['parentEmailSender'];
$message->to        = $this->email;
$message->subject   = sprintf(self::APPROVAL_EMAIL_SUBJECT, $name_organisation_or_student);

$message->setBody(array(
        'data' => $this
), 'text/html');

return Yii::app()->mail->send($message);
Zabs
  • 13,852
  • 45
  • 173
  • 297
  • 1
    It may be that yout problem isn't the PHP code, but the server you're running the script on. If there is a firewall, or your postfix isn't configured correctly, then no mail is sent... Try to check the /var/log/mail.* logs – Matthias Dunkel Jul 22 '14 at 09:28
  • See [this question](http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) for tips on troubleshooting this as it is very similar – John Conde Jul 22 '14 at 11:41

0 Answers0