简体   繁体   中英

Codeigniter - Sending email

i try to send email with codeigniter on localhost.

In order to that, in config directory i open a new php file called email

and write

<?php

$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'mertmetinbjk@gmail.com',
    'smtp_pass' => 'pass',
);
$this->load->library('email', $config);

?>

and in my controller write this

$this->load->library('email');
        $this->email->from('bildirim@pasaj.com','Pasaj.com');
        $this->email->to($email);
        $this->email->subject('pasaj hesabinizi aktive etmek icin');
        $this->email->message('Tıkla');
        $this->email->send();

but i get these errors:

在此处输入图片说明

i made some research on the Internet, i read that i have to enable ssl from my php.ini file but there is no line like what can i do ?

TY

Try this;

$email =$this->input->post('email');
$this->load->library('email');
$this->email->from('bildirim@pasaj.com','Pasaj.com');
$this->email->to($email);
$this->email->subject('pasaj hesabinizi aktive etmek icin');
$this->email->message('Tıkla');
$this->email->send();

try this:

$this->email->initialize($config);

instead of this:

$this->load->library('email', $config);

Your controller would look like this:

$this->load->library('email');
$this->email->from('bildirim@pasaj.com','Pasaj.com');
$this->email->to($email);
$this->email->subject('pasaj hesabinizi aktive etmek icin');
$this->email->message('Tıkla');
$this->email->send();

Perhaps it's a good thing to post the answer you got from the CodeIgniter Forums

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM