【发布时间】:2013-02-08 11:03:21
【问题描述】:
我使用 Xampp,我想使用 CodeIgniter 发送电子邮件。如果使用 smtp 报错:
消息:fsockopen():无法连接到 ssl://smtp.googlemail.com:465(找不到套接字传输 "ssl" - 你在配置 PHP 时忘记启用它了吗?) 文件名:libraries/Email.php
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'gmail@gmail.com',
'smtp_pass' => 'your_password'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('your@example.com', 'Your Name');
$this->email->to('(here I put my mail)@yahoo.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
(line extension=php_openssl.dll is decomented)
使用这些设置:
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from('your@example.com', 'Your Name');
$this->email->to('(here I put my mail)@yahoo.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
出现消息:您的消息已使用以下协议成功发送:邮件
来自:“你的名字” 返回路径:.......
但我没有收到任何邮件。
有什么问题?
【问题讨论】:
-
听起来您需要自己的邮件服务器。 p.s.如果您要对某事投反对票,请发表评论并说明原因。在那之前投票。
-
@Nick 这不是投票应该如何运作的。请不要仅仅为了抵消其他人的反对而投票。
-
@Pekka웃 如果有人不解释他们为什么投反对票,因为他们应该这样做,那么我认为没有理由破坏某人的声誉。他们至少可以被告知如何改进。投票并非没有理由
-
您不能使用与您发送的服务器无关的“发件人”地址发送电子邮件。这势必会让您的邮件进入垃圾邮件过滤器。
-
另外,请尝试从 smtp_host 行中删除
ssl://。
标签: php apache codeigniter xampp