0

Config File:

$config['use_ci_email'] = TRUE; 
$config['email_config'] = array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'Myt E-mail Address',
    'smtp_pass' => 'My Correct Password',
    'mailtype' => 'html',
    'charset' => 'UTF-8'
);

Library:

$this->email->set_newline("\r\n");

Error:

fsockopen(): Peer certificate CN=`l2.iserverplanet.net' did not match expected CN=`smtp.googlemail.com'
fsockopen(): Failed to enable crypto
fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)

How can I resolve This Error and why it appearing to me? Please help me.

Rushabh Shah
  • 495
  • 3
  • 6
  • 21

1 Answers1

0
$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx',
    'smtp_pass' => 'xxx',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

// Set to, from, message, etc.

$result = $this->email->send();

Also SSL must be enabled:

extension=php_openssl.dll

Source: Sending email with gmail smtp with codeigniter email library

Community
  • 1
  • 1
Callombert
  • 1,099
  • 14
  • 38