Unable to send email using SMTP gmail config in codeigniter 3

前端 未结 3 1176
醉话见心
醉话见心 2021-01-13 14:01

Below are my code and I refer all examples in stack overflow and codeigniter user guide. still I unable to solve this

public function send()
{
    $config[\         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-13 14:32

    Are you 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();
    

    And make sure you had setting your email account with Allowing less secure apps to access your account

提交回复
热议问题