0

我知道这个问题已经发布,但我找不到我的问题的答案。我正在使用 codeigniter 通过 gmail 服务器发送电子邮件。这是用于此任务的一段代码:

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['mail_path'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = 'my-email@gmail.com';
$config['smtp_pass'] = '******';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '30';
$config['mailtype'] = 'text';
$config['charset'] = 'utf-8';
$config['validate'] = TRUE;
$config['crlf'] = '\r\n';
$config['newline'] = '\n\n';

$this->load->library('email',$config);
$this->email->from('my-email@gmail.com');
$this->email->to('another-email');
$this->email->subject('Validation');

$message = "some message";

$this->email->message($message);

$this->email->send();

$this->email->print_debugger()用来显示错误。以下是我收到的消息:

The following SMTP error was encountered: 13 Unable to find the socket transport "ssl" -
did you forget to enable it when you configured PHP?
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error: 
Unable to send data: MAIL FROM:
from: 
The following SMTP error was encountered: 
Unable to send data: RCPT TO:
to: 
The following SMTP error was encountered: 
Unable to send data: DATA
data: 
The following SMTP error was encountered: ...

当然,我在我的 php.ini 文件中取消了与 SSL 对应的行的注释...

有什么想法吗 ?

谢谢 :)

4

1 回答 1

0

NetTuts 上有一个关于这个主题的很好的教程。这是它的链接:http: //net.tutsplus.com/articles/news/codeigniter-from-scratch-day-3/

源代码可下载。

于 2012-04-16T13:21:12.913 回答