Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • How to Send Email in CodeIgniter

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 353
    Comment on it

    Hello Readers, In this blog I am providing information about How to Send Email through CodeIgniter Programming.

    Sending Email in CodeIgniter is very Simple. Configuration of Email can be done in one of the Controller file of our Application as shown below :

    //Load the pre defined helper Library 'Email'
    $this->load->library('email');
    $this->email->from('Test@example.com', 'Our Name');
    $this->email->to('Someone@example.com');
    $this->email->cc('Another@example.com');
    $this->email->bcc('test@example.com');
    $this->email->subject('Email Test');
    $this->email->message('Testing the email sending ');
    $this->email->send();
    echo $this->email->print_debugger();  //Show the Result 

    For Example :

    function Mail()
    {
      $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => 'xxx@gmail.com', 
      'smtp_pass' => 'xxx',
      'mailtype' => 'html',
      'charset' => 'iso-8859-1',
      'wordwrap' => TRUE
    );
    
            $message = 'Sending mail through codeigniter from localhost';
          $this->load->library('email', $config);
          $this->email->set_newline("\r\n");
          $this->email->from('xxx@gmail.com'); 
          $this->email->to('xxx@gmail.com');
          $this->email->subject('Email from CodeIgniter');
          $this->email->message($message);
          if($this->email->send())
         {
          echo 'Email sent.';
         }
         else
        {
         show_error($this->email->print_debugger());
        }
    
    }

     

    Sending email in CodeIgniter

 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: