我在stackoverflow上尝试了很多东西,但仍然无法发送邮件,也许我的配置错了;代码在实时服务器中运行
public function(){
// configuration
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'my_email',
'smtp_pass' => 'my_password',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => true
);
$this->load->library('email',$config);
$this->email->from('my_email','Administrator');
$this->email->to('my_friends_email');
$this->email->subject($subject);
$this->email->message($message);
return ($this->email->send()); }
答案 0 :(得分:1)
试试这个
$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();
答案 1 :(得分:0)
如果主机帐户允许使用STMP中继或外部SMTP,则需要咨询您的服务器提供商。