A
A
Alexey Verkhovtsev2016-12-07 23:06:29
CodeIgniter
Alexey Verkhovtsev, 2016-12-07 23:06:29

Why is Codeiginter mail not being sent?

Hello everyone, I'm trying to send a letter from the site, but it does not come, I've been sitting for 2 hours, I've broken my head. I tried to send both in the controller and in the model, and simply by writing and stuffing it into the function, and all to no avail. This is what the test send code looks like

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

            $this->email->from('[email protected]');
            $this->email->to('[email protected]');
            $this->email->subject('sbj');
            $this->email->message('msg');
            if( !$this->email->send() ) {
                echo 'NO';
                echo $this->email->print_debugger();
            }

In the config folder, an email.php configuration file has been created with the following content
<?php
  $config['protocol'] = 'mail';
  $config['charset'] = 'utf-8';
  $config['priority'] = '1';

Please, help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krypt3r, 2016-12-08
@krypt3r

What does print_debugger() return and what is in the mail server logs? And try this configuration

$this->email->initialize (array (
            'mailtype' => $mailtype, 
            'charset' => $charset,
            'useragent' => 'PHPSender',
            'protocol' => 'smtp',
            'smtp_host' => $host,
            'smtp_port' => 25,
            //'mailpath' => '/sbin/sendmail',
            /**'smtp_user' => '',
            'smtp_pass' => '',*/
        ));

That is, try adding the smtp_* options.

M
MrKMV34, 2016-12-10
@MrKMV34

$config['mailtype'] = 'html';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.domen.ru';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'user';
$config['smtp_pass'] = 'password';

with this email.php should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question