0

I tried many things over stackoverflow but still can not mail, maybe my configuration is wrong; the code is running in a live server

      public function(){
    // configuration
    $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => 'my_email', 
      'smtp_pass' => 'my_password', 
      'mailtype' => 'html',
      'charset'  => 'iso-8859-1',
      'wordwrap'   => true

    );
    $this->load->library('email',$config);
    $this->email->from('my_email','Administrator');
    $this->email->to('my_friends_email');
    $this->email->subject($subject);
    $this->email->message($message);
    return ($this->email->send()); }

2 Answers2

1

Just try this

$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();
Siddhartha esunuri
  • 1,104
  • 1
  • 17
  • 29
0

You'll need to check with your server provider if the STMP Relay or External SMTP is allowed in your hosting account.