Skip to content

Instantly share code, notes, and snippets.

@arbaaz
Created February 11, 2014 07:37
Show Gist options
  • Save arbaaz/8930642 to your computer and use it in GitHub Desktop.
Save arbaaz/8930642 to your computer and use it in GitHub Desktop.
email using CI
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mail extends CI_Controller {
function __construct()
{
parent::__construct();
//Do your magic here
$this->load->model('membership_model');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp3.netcore.co.in',
'smtp_port' => 25,
'smtp_user' => '[email protected]',
'smtp_pass' => 'Supp0rt',
'mailtype' => 'html',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$this->load->library('email',$config);
}
function send_mail($value='')
{
$message=base_url().'mail/verify_email/'.'916412fceda2a6b7f46f7a544ba33feb';
$this->email->from('[email protected]', 'Support');
$this->email->to('[email protected]');
$this->email->cc('');
$this->email->bcc('');
$this->email->subject('Password Reset');
$this->email->message($message);
if ( ! $this->email->send())
{
// Generate error
echo "Email is not sent!!";
}
echo $this->email->print_debugger();
}
public function index()
{
}
function verify_email($value='')
{
$result=$this->membership_model->verify_email_model($value);
if ($result) {
echo "your email has been verified";
}
}
}
/* End of file mail.php */
/* Location: ./application/controllers/mail.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment