Here are the steps to setup email on CI using SendGrid
Step 1: you will need an account on SendGrid - http://sendgrid.com
Step 2: After you have the SendGrid username and password
Step 3: Go to Codeigniter framework application folder
edit the following files
/application/config/email.php
Now the file should be have the below sendGrid Code
<?php
$config['protocol'] = 'smtp';
$config['charset'] = 'utf-8';
$config['smtp_host'] = 'smtp.sendgrid.net';
$config['smtp_user'] = 'your_send_grid_username';
$config['smtp_pass'] = 'your_send_grid_password';
$config['smtp_port'] = 587;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html'; //Use 'text' if you don't need html tags and images
Step 4: Create a controller to test the sendgrid email api working or not
Edit the following files
application/controllers/welcome.php
Paste the below function in to the existing welcome controller
function send_mail(){
$this->load->library('email');
$this->email->from('support@site4developer.blogspot.com', 'Manikanta');
$this->email->to('standardservices2@gmail.com');
$this->email->cc('unlock4datacards@gmail.com');
$this->email->bcc('manikantak49@gmail.com');
$this->email->subject('Email Test With SEND Grid');
$this->email->message('Testing the email class.');
$this->email->send();
}
Step 5: Change email id as per your needs and then execute the code
Step 6: Check mail inbox whether you have received email or not..
If you have need any on codeigniter, mail or chat me with this email manikantak49@gmail.com
Step 1: you will need an account on SendGrid - http://sendgrid.com
Step 2: After you have the SendGrid username and password
Step 3: Go to Codeigniter framework application folder
edit the following files
/application/config/email.php
Now the file should be have the below sendGrid Code
<?php
$config['protocol'] = 'smtp';
$config['charset'] = 'utf-8';
$config['smtp_host'] = 'smtp.sendgrid.net';
$config['smtp_user'] = 'your_send_grid_username';
$config['smtp_pass'] = 'your_send_grid_password';
$config['smtp_port'] = 587;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html'; //Use 'text' if you don't need html tags and images
Step 4: Create a controller to test the sendgrid email api working or not
Edit the following files
application/controllers/welcome.php
Paste the below function in to the existing welcome controller
function send_mail(){
$this->load->library('email');
$this->email->from('support@site4developer.blogspot.com', 'Manikanta');
$this->email->to('standardservices2@gmail.com');
$this->email->cc('unlock4datacards@gmail.com');
$this->email->bcc('manikantak49@gmail.com');
$this->email->subject('Email Test With SEND Grid');
$this->email->message('Testing the email class.');
$this->email->send();
}
Step 5: Change email id as per your needs and then execute the code
Step 6: Check mail inbox whether you have received email or not..
If you have need any on codeigniter, mail or chat me with this email manikantak49@gmail.com
Thank you for reading keep visiting
0 comments:
Post a Comment