1

I am attempting to send an email using Cake's 'Email' component. I have included the component into my controller and I am using the following code to try send an email.

$this->Email->from = 'Glecto <[email protected]>';
$this->Email->to = '[email protected]';
$this->Email->replyTo = '[email protected]';
$this->Email->subject = 'Let\'s get started!';
$this->Email->delivery = 'mail';
$this->Email->send('Thank you for signing up');

I've also checked my php.ini to ensure the SMTP setting are set up correctly.

Can anyone spot anything wrong that I'm doing here?

1
  • Have you checked that the SMTP settings are correct by trying to send mail using PHP's own mail() function?
    – JJJ
    Sep 8, 2011 at 13:39

1 Answer 1

4
/* SMTP Options */
$this->Email->smtpOptions = array(
'port'=>'25',
'timeout'=>'30',
'host' => 'your.smtp.server',
'username'=>'your_smtp_username',
'password'=>'your_smtp_password',
'client' => 'smtp_helo_hostname'
);
/* Set delivery method */
$this->Email->delivery = 'smtp';
/* Do not pass any args to send() */
$this->Email->send();
/* Check for SMTP errors. */
$this->set('smtp_errors', $this->Email->smtpError);
1
  • I have tried this but It still doesn't seem to work! I'll give it another shot later today. Sep 14, 2011 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.