• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gmail SMTP using SSL/TLS

#11
[eluser]chuckleberry13[/eluser]
Worked great and fixed my smtp problem!

Thanks!

#12
[eluser]sophistry[/eluser]
my ISP just blocked port 25 outgoing so i had to figure out how to get around it.

i just implemented this google smtp set up and it is working great - even using google apps with my own domain.

i had one problem that is worth mentioning... i forgot to add the crucial line:
Code:
$this->email->set_newline("\r\n");

and it resulted in an 500 "Internal Server Error" page and php_wrapper.cgi message in the php error log. so i ended up going on a wild goose chase. eventually, i realized that i had left out the set_newline() call.

moral of the story: make sure you set_newline() as described by the OP.

#13
[eluser]cellulit[/eluser]
Looks so great, just one small thing... I put all the params into email.php and the page "hangs" forever, even though the timeout is set to 30 secs. no echo with debug either (i used to get it before making other mistakes). any idea what can be happening?
thanks in advance!!!

email.php
Code:
$config['protocol']='smtp';
$config['smtp_host']='ssl://smtp.googlemail.com';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='my gmail';
$config['smtp_pass']='my gmail pass';
$config['charset']='utf-8';
$config['newline']='\r\n';

the controller
Code:
$this->load->library(array('form_validation','recaptcha','email'));
[...]

$this->email->from('[email protected]','tralalala');
$this->email->to($this->input->post('email'));
$this->email->subject('testing');
$this->email->message('live! damn it...');
$this->email->send();
echo $this->email->print_debugger();

#14
[eluser]sophistry[/eluser]
you need to use double-quotes on your
Code:
$config['newline']="\r\n";
- single quotes do not work.

#15
[eluser]cellulit[/eluser]
So simple... thank you!!! :lol:

#16
[eluser]sophistry[/eluser]
you are welcome! and thank YOU for *posting code* so the problem was immediately apparent. i wish other people asking questions in these forums were as proactive! :-)

#17
[eluser]Carlos Alcala[/eluser]
Hey Forum.

I made a custom defined using constants.php file on config/constants.php and then developed a custom smtpconfig function on a controller model to suit the smtp email configuration and the use on a send emailtest function on a controller, please visit my weblog to view the solution:


http://www.carlos-alcala.com/?p=84

Just for the note, I have found that PASSING an string array from config/email.php to the library email constructor (load library) has the bug like the initialize on the SMTP_AUTH so the Gmail test nevers authenticates, I have found after several hours of dev/test.

I hope you like this solution, using gmail and it works fine !!


PS. For Windows XAMP users: uncomment the line extension=php_openssl.dll on the php.ini to work with SSL

#18
[eluser]smithas[/eluser]
hi.I worked out the code you gave..It shows that "your email is sent" ..but it is not actually sending out the mail..
here the code
Quote:<?php

class Test_email extends Controller
{
function Test_email()
{
// load controller parent
parent::Controller();
$this->load->library('email');
}
function sendEmail()
{



$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'pwd',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

$this->email->from('[email protected]', 'Smitha');
$this->email->to('[email protected]');

$this->email->subject(' CodeIgniter Rocks ');
$this->email->message('Hello World');


if (!$this->email->send())
show_error($this->email->print_debugger());
else
echo 'Your e-mail has been sent!';


}
}

why is this happening?I had openssl enabled..but still the same problem

#19
[eluser]Carlos Alcala[/eluser]
1. I have made the configuration usign constants with DEFINE for ONE SIMPLE REASON, the email library has a bug using an ARRAY CONFIGURATION LOAD LIKE IN YOUR CODE, I have made it that way also with NO SUCCESS, and it seems a problem on the email library constructor usign it that way, so please FOLLOW THE EXAMPLE EXACTLY.

2. Check the port 465 is open on firewall.

3. The show_errors is not showing anything?

4. Are you using a correct Gmail account and password? because you posted a code taht seems a little different from my code.

5. Please follow the code correctly using de DEFINE on the constants.php on my website and then post your results.

6. Please try www.getfirebug.com to verify any errors.

Hope you can get work, this seems a missunderstood problem on your code.

Sincerely,

Carlos

#20
[eluser]smithas[/eluser]
thank you.. can u please post me your code?
465 is open.
and email address i gave i s valid one..


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.