我想使用SMTP协议通过server发送电子邮件。我的服务器是主机gator。 enter image description here
答案 0 :(得分:0)
您需要配置用户并传递配置
更好地说明您的问题
答案 1 :(得分:0)
谢谢...我用相同的代码完成了...
只需更改端口,然后即可工作。...
这是代码
函数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();
}