CodeIgniter Forums
How use the gmail SMTP for sending email - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How use the gmail SMTP for sending email (/showthread.php?tid=37342)

Pages: 1 2


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]mahe11[/eluser]
Hi all,
how i use Gmail SMTP for sending email.. Plz help me and where i will change my config setting.
And I need to show it in normal structure.
Plz help me... its need to me..


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]Atharva[/eluser]
There are plenty of threads related to this like this one.


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]Cristian Gilè[/eluser]
Hi mahe11,

Code:
$config['protocol']  = 'smtp',
$config['smtp_host'] = 'smtp.gmail.com'; //or ssl://smtp.googlemail.com
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'your_gmail_pass';
$config['smtp_port'] = 465;



How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]mahe11[/eluser]
Hi Atharva and Cristian Gilè,

Hey sorry ,
@cristian Gilè
where i use the
Code:
$config['protocol']  = 'smtp',
$config['smtp_host'] = 'smtp.gmail.com'; //or ssl://smtp.googlemail.com
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'your_gmail_pass';
$config['smtp_port'] = 465;


actually i create new php file in application/config/email.php and put above code in that.

but still now not working... and give fatal error

Fatal error: Maximum execution time of 60 seconds

plz help me where i put that code and can add smtp username, pass in /system/libraries/Email.php


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]Atharva[/eluser]
[quote author="mahe11" date="1294333237"]Hi Atharva and Cristian Gilè,

Hey sorry ,
@cristian Gilè
where i use the
Code:
$config['protocol']  = 'smtp',
$config['smtp_host'] = 'smtp.gmail.com'; //or ssl://smtp.googlemail.com
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'your_gmail_pass';
$config['smtp_port'] = 465;


actually i create new php file in application/config/email.php and put above code in that.

but still now not working... and give fatal error

Fatal error: Maximum execution time of 60 seconds

plz help me where i put that code and can add smtp username, pass in /system/libraries/Email.php[/quote]

Nope, you can write the code in controller itself.
Code:
$config['protocol']  = 'smtp',
$config['smtp_host'] = 'smtp.gmail.com'; //or ssl://smtp.googlemail.com
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'your_gmail_pass';
$config['smtp_port'] = 465;

$this->load->library('email');
$this->email->initialize($config);
$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
$this->email->cc('[email protected]');
$this->email->bcc('[email protected]');

$this->email->subject('Email Test');
$this->email->message('Testing the email class.');    

$this->email->send();

Have a look at email lib

Edit: It is good to use
Code:
echo $this->email->print_debugger();
for debugging purpose after
Code:
$this->email->send();



How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]mahe11[/eluser]
thanks Atharva,
i use that as ur suggestion, but still now i get fatal error: Maximum execution time of 60 seconds exceeded. /system/libraries/Email.php on line 1818
so plz guide me, what i do now plz


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]Cristian Gilè[/eluser]
It seems a known issue that has been fixed after setting
Code:
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";



How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]mahe11[/eluser]
thanks Cristian Gilè and also Atharva
it work properly , thanks a lot. Smile
Now plz tell me can I show the my gmail Inbox and Sentbox in own page. if yes then plz help me..
Thanks again....


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]Cristian Gilè[/eluser]
GMail API

Good luck


Cristian Gilè


How use the gmail SMTP for sending email - El Forum - 01-06-2011

[eluser]mahe11[/eluser]
thanks, i will try to it.