Advertisement
Guest User

Using Gmail SMTP with CakePHP

a guest
Jun 25th, 2011
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2. /* SMTP Options */
  3. $this->Email->smtpOptions = array(
  4.     'port'=>'465',
  5.     'timeout'=>'30',
  6.     'host' => 'ssl://smtp.gmail.com',
  7.     'username'=>'me@gmail.com',
  8.     'password'=>'password',
  9.     'client'=>"helo gmail.com"
  10. );
  11. /* Set delivery method */
  12. $this->Email->delivery = 'smtp';   
  13.  
  14. $this->Email->from = "<me@gmail.com>";
  15. $this->Email->to = "<you@gmail.com>";
  16. $this->Email->subject = "Subject";
  17. $this->Email->sendAs = 'html';
  18.  
  19. if (!$this->Email->send($_GET['message'])){
  20.     $this->set('smtp_errors', $this->Email->smtpError);
  21.     echo "fail ";
  22.     debug($this->Email->smtpError);
  23.     exit;
  24. }else{
  25.     echo "success";
  26.     exit;
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement