문제

I have a problem when sending email using codeigniter and when i'm printing

$this->email->print_debugger();

it prints:

"Your message has been successfully sent using the following protocol: mail"

but the user can't receive any email after it successfully sends.

here is my code when sending email:

date_default_timezone_set('Asia/Manila');
    $this->load->helper('string');
    $password= random_string('alnum', 8);

    $data = array ('password' => md5($password),
                           'tag' => 0
            );
    $this->db->where('emp_id', $user['employee_id']);
    $this->db->update('credentials', $data);
    $this->load->library('email');
    $this->email->from('noreply@company.com', 'company');
    //$this->email->reply_to('noreply@company.com');
    $this->email->to($user['company_email']);   
    $this->email->subject('Password reset');
    $this->email->message('You have requested a code. Here is your code: '. $password);  
    $check = $this->email->send();

and here is my code when in my config file:

$ci = get_instance();
$ci->load->library('email');
$config['protocol'] = "sendmail";
$config['smtp_host'] = "ssl://mail.company.com";
//$config['smtp_port'] = "465";
$config['smtp_port'] = "25";
//$config['smtp_user'] = "person@company.com"; 
//$config['smtp_pass'] = "";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";

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

when we are in the internal network, i can send email successfully. but when i'm at home trying to send email. the code still works but the user can't receive email. thanks in advance guys !

도움이 되었습니까?

해결책

Try

$config['protocol'] = "http";

or

$config['protocol'] = "smtp";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top