Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Send an Email using email component in cakephp

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 209
    Comment on it

    Hello reader if you want to send email using the email component in cakephp you need to run the email component of cakephp ex

    You should place email send routine in your AppController:

    function _sendMail($to,$subject,$template) {
        $this->Email->to = $to;
        // $this->Email->bcc = array('secret@example.com'); // copies
        $this->Email->subject = $subject;
        $this->Email->replyTo = 'noreply@domain.com';
        $this->Email->from = 'MyName <noreply@domain.com>';
        $this->Email->template = $template;
        $this->Email->sendAs = 'text'; //Send as 'html', 'text' or 'both' (default is 'text')
        $this->Email->send();
    }
    

    Here $to is sender email.

    Then use it from ANY controller like this:

      $this->_sendMail($this->data['User']['email'],'Thanks
      for registering!','register');
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: