Email test fails but PHP *can* send email
The C5 dashboard email test for default PHP fails with:
The following error was found while trying to send the test email:
Unable to send mail: Unknown error
However doing putting mail('[email protected]', 'test', 'testing'); into the package's controller on_start() result in an email arriving immediately in my inbox after a page load so Apache php.ini is obviously fine and email through default PHP certainly works.
So what's going on?
$mail = \Core::make('mail'); $mail->setTesting($testing); $mail->setBody("Dear concrete5 team\nYour CMS is by far the best I\'ve ever seen."); $mail->addParameter('mailContent', $body); $mail->load('default', 'packagehandle'); // add any parameters before loading the template $mail->setSubject($subject); $mail->from($from, $from_name); $mail->to($to); $mail->sendMail();
But writing my own email class isn't going to suddenly make system generated emails like registration validation suddenly start working.