为什么这个功能不适用于zoho邮件?

时间:2018-04-11 06:32:22

标签: php codeigniter email

//发送电子邮件功能

public function sendemail(){

    $from1 = $this->input->post('from');//input name
    $to1 = $this->input->post('to');//input name
    $subject1 = $this->input->post('subject');//input name
    $message1 = $this->input->post('message');//input name
    $config = Array(
          'protocol' => 'smtp',
          'smtp_host' => 'ssl://smtp.googlemail.com',
          'smtp_port' => 465,
          'smtp_user' => 'malinga@bckonnect.com',
          'smtp_pass' => 'mal@pass',
          'mailtype' => 'html'
    );
    $this->load->library('email', $config);//load library Codeigniter
    $this->email->set_newline("\r\n");
    // Set to, from, message, etc.
    $this->email->to($to1);
    $this->email->from($from1,$from1);
    //$this->email->bcc("example2@domain.com"); 
    $this->email->subject($subject1);
    $this->email->message($message1);    
    $result = $this->email->send();

    $this->session->set_flashdata('msg','<div class="alert alert-success">Message Sent Successfully!</div>');
    redirect('welcome/index');

}

这是我的电子邮件功能代码。它适用于gmail。但它不适用于Zoho邮件。为什么?

1 个答案:

答案 0 :(得分:0)

您应该添加Zoho邮件SMPT配置:

isEqual(a,b,c) && isTriplet(a,b,c)

所以它会像

Outgoing Server Name: smtp.zoho.com
Port: 465 with SSL or
Port: 587 with TLS
Require Authentication: Yes

参考:https://www.zoho.com/mail/help/imap-access.html