Send Email from your Gmail account Using Codeigniter.
Codeigniter provides many built in helpers and libraries which help us to perform lot of functionality for developing projects. Here a simple email library make us able to send email using our Gmail account living in CI environment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | <? class Send_Email extends Controller { function Send_Email() { parent::Controller(); } function index() { $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'email_address@gmail.com', // change it to yours 'smtp_pass' => 'your_password', // change it to yours 'mailtype' => 'html', 'charset' => 'iso-8859-1', 'wordwrap' => TRUE ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('your_email@domain.com'); // change it to yours $this->email->to('your_email@domain.com'); // change it to yours $this->email->subject('Email using Gmail.'); $this->email->message('Working fine ! !'); if($this->email->send()) { echo 'Email sent.'; } else { show_error($this->email->print_debugger()); } } }?> |
Who I Am

Zeeshan Rasool
Software Engineer - PHP
Lahore - Pakistan
zeeshan(@)99points.info
Skype: zeeshan-rasool
gTalk: zishan.rasool85
Categories
- AJAX (37)
- Codeigniter (16)
- CSS (16)
- Facebook (11)
- Joomla (1)
- JQuery (53)
- Miscellaneous (4)
- Mootools (1)
- MySQL (6)
- PHP (60)
- SEO (2)
- Technology (6)
- Tutorials (15)
- Twitter (2)
- Web Design (23)
- Web Development (57)
- WordPress (2)
Tags
99points
adobe
AJAX
ajax pagination
ajax rating
ajax tutorial
ajax voting system
captcha
Codeigniter
codeigniter 2.0
codeigniter recaptcha
CSS
css tutorials
dreamweaver cs5
Facebook
facebox
farmville
ffmpeg
flv
google api
hacking
Joomla
JQuery
JQuery Gallery
JQuery menus
Jquery tutorial
mafia war
Mootools
MySQL
pagination
Payment
PHP
php curl
recaptcha
RSS Feed
SEO
simplepie
socail networking
ssl
Tutorials
Twitter
wall script
Web
XSS
youtube
Comments
- ZeeShaN on Facebook Wall Script Clone with JQuery and PHP: Personal Project BETA Version 2.0
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on JQuery Based Flipped Image Gallery with Bounce Effects
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on Fresh JQuery Image Gallery with Captions and Auto Play/Pause Rotation
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on jQuery Tutorial: Create jQuery and CSS based Awesome navigation.
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on Ajax Tutorial: How to Create Ajax Search Using PHP jQuery and MYSQL
ZeeShaN







Would someone tell me the modifications required to send the mail from the hosting server?
how to convert website which is developing using codeigniter and php in english language to another language.
The following error are occur
1.A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1652
2.A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
3.The following SMTP error was encountered: 142484584 Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
Thanks.
Nice tutorial
Thanks …….. nice tutorial
thanks for share ….
[...] This post was mentioned on Twitter by 99_Points. 99_Points said: Send Email from your Gmail account Using Codeigniter. http://bit.ly/agJht8 [...]
Thank you Zeeshan for sharign this idea