I cannot send mail using CodeIgniter. It displays the following error.
fwrite(): send of 28 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
This my settings in email.php library
public $useragent = 'CodeIgniter';
public $mailpath = '/usr/sbin/sendmail'; // Sendmail path
public $protocol = 'smtp'; // mail/sendmail/smtp
public $smtp_host = 'smtp.mailhostbox.com';
public $smtp_user = 'xxx@xx.in';
public $smtp_pass = 'xxxxxx';
public $smtp_port = 25;
public $smtp_timeout = 5;
public $smtp_keepalive = FALSE;
public $smtp_crypto = '';
public $newline = "\r\n";
I could send email till yesterday. But from today morning, it shows this error.
UPDATE :
I have changed my host to gmail
, but still not working. The following are the changes I made
public $useragent = 'CodeIgniter';
public $mailpath = '/usr/sbin/sendmail'; // Sendmail path
public $protocol = 'smtp'; // mail/sendmail/smtp
public $smtp_host = 'smtp.gmail.com';
public $smtp_user = 'noreply.xxx@gmail.com';
public $smtp_pass = 'xxxxxx';
public $smtp_port = 465;
public $smtp_timeout = 5;
public $smtp_keepalive = FALSE;
public $smtp_crypto = 'ssl';
public $newline = "\r\n";
But it shows error as
Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465:465 (Failed to parse address "smtp.gmail.com:465:465")
I changed the port from 465 to 587 as follows
public $smtp_port = 587;
public $smtp_crypto = 'tls';
But I got this error
Message: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
I couldn't understand what is the real issue, because it throws errors in every possible conditions