Welcome Guest, Not a member yet? Register   Sign In
Email config file
#4

[eluser]Chathuranga Tennakoon[/eluser]
i have made a blog post to send email with codeigniter using gmail server. please refer the following code.sometimes it may be helpful for you Wink

Code:
<?php
class EmailClass extends CI_Model {

     var $emailUsername="[email protected]";
     var $emailPassword="yourPassword";
     var $emailHost="ssl://smtp.googlemail.com";
     var $emailProtocol="smtp";
     var $emailPort="465";
     var $emaiType="html";
    
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
        //$this->load->helper("url");
    }
    
    
function sendEmail($emailFrom,$emailTo,$subject,$message){
    
$config = Array(
  'protocol' => $this->emailProtocol,
  'smtp_host' => $this->emailHost,
  'smtp_port' => $this->emailPort,
  'smtp_user' => $this->emailUsername, // change it to yours
  'smtp_pass' => $this->emailPassword, // change it to yours
  'mailtype' => $this->emaiType,
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
);
  $this->load->library('email', $config);
  $this->email->set_newline("\r\n");
  $this->email->from($emailFrom); // change it to yours
  $this->email->to($emailTo); // change it to yours
  $this->email->subject($subject);
  $this->email->message($message);

  if($this->email->send())
  {

   return true;

  }
  else
  {
   show_error($this->email->print_debugger());
    
   return false;
  }
  
    
}
    
        
}//class
        
?>


Messages In This Thread
Email config file - by El Forum - 03-24-2012, 05:56 PM
Email config file - by El Forum - 03-24-2012, 06:11 PM
Email config file - by El Forum - 03-24-2012, 06:13 PM
Email config file - by El Forum - 03-27-2012, 11:50 AM
Email config file - by El Forum - 05-23-2012, 04:07 AM
Email config file - by El Forum - 05-23-2012, 05:56 AM
Email config file - by El Forum - 05-23-2012, 06:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB