I am trying to get CakeEmail working and I am getting a "Could not send email" Internal Error.
The last line of the stack trace is
CORE/Cake/Network/Email/MailTransport.php line 47 -> MailTransport->_mail(string,string,string,string,null)
In my email.php config I have
class EmailConfig {
public $default = array(
'transport' => 'Mail',
'from' => 'no-reply@xxxxx.com.au'
);
}
I receive my email address from a form and am trying to send an email to the subscriber. My code is as follows
$email_addr = $subs_data['Subscriber']['subscriber'];
$Email = new CakeEmail('default');
$Email->emailFormat('html')
->template('welcome')
->to($email_addr)
->subject('New Subscription')
->send();
I have done some testing and the value in $email_addr is exactly what is coming from the form and is a valid Email address.
I have a template in View/Emails/html/welcome.ctp that for now is just a very basic message
Looking at the stack trace and line 47 in MailTransport.php I have found the error appears to be to do with the "to" email address. I can not see what is wrong with it though. I have looked at a lot of examples and as far as I can tell I am not doing anything wrong.
I would appreciate any help so I could get this application finished.
Kind Regards
Richard