通过服务器使用codeigniter库发送电子邮件

通过服务器使用codeigniter库发送电子邮件,codeigniter,server,smtp,Codeigniter,Server,Smtp,我想通过服务器使用SMTP协议发送电子邮件。我的服务器是主机gator。 您需要配置用户并传入配置 更好地指定您的问题谢谢。。。我用同样的代码做的 只需更改端口,即可正常工作 这是代码 函数do_email($msg=NULL,$sub=NULL,$to=NULL,$from=NULL){ $this->load->library('email') $config = array(); $config['protocol']='smtp'; $config['smtp_h

我想通过服务器使用SMTP协议发送电子邮件。我的服务器是主机gator。

您需要配置用户并传入配置


更好地指定您的问题

谢谢。。。我用同样的代码做的

只需更改端口,即可正常工作

这是代码

函数do_email($msg=NULL,$sub=NULL,$to=NULL,$from=NULL){ $this->load->library('email')

    $config = array();
    $config['protocol']='smtp';
    $config['smtp_host']='localhost';
    $config['smtp_port']='587';
    $config['charset']='utf-8';
    $config['newline']="\r\n";
    $config['wordwrap'] = TRUE;
    $config['mailtype'] = 'html';

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


    $this->email->from($from, $system_name);
    $this->email->to($to);
    $this->email->subject($sub);
    $this->email->message($msg);
    $email = $this->email->send();

}