i wish to use gmail smtp to send user information to the registered email.
The code that i am using is working fine in my localhost, but when i changed into shared hosting it come out with the below error.
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1652
A PHP Error was encountered
Severity: Warning
Message: fwrite(): supplied argument is not a valid stream resource
Filename: libraries/Email.php
Line Number: 1795
.... (more error msg here)
An Error Was Encountered
The following SMTP error was encountered: 110 Connection timed out
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
.... (more error msg here)
Here's my email config
$pass = $this->generatePassword('6');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_timeout'=>'30',
'smtp_user' => '[email protected]',
'smtp_pass' => 'mypassword',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("
");
$this->email->from('[email protected]','Title');
$this->email->to($this->input->post('email'));
$this->email->subject('Subject here');
$this->email->message('Your login username is '.$this->input->post('username').'<br/>'.'Password is '.$pass);
if (!$this->email->send()){
show_error($this->email->print_debugger());
}else{ echo 'YEAH!!!';}
i try to check my share hosting openssl whether is enabled or not. and i found this
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
If openssl is enabled. still what will be the mistake in my code?
I start to be frustrated to use my localhost to develop and when its uploaded to share hosting, it came out wit lots of error.
Any help would be appreciate!! thx in advanced
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…