在 Codeigniter 中使用 hotmail 发送电子邮件?
我正在尝试弄清楚如何使用 codeigniter 发送电子邮件,并且我使用我的 gmail 帐户成功地做到了这一点。
但问题是我不知道如何使用我的 hotmail 帐户执行此操作...
这是使用 gmail 的代码:
<?php
class Email extends CI_Controller
{
function index()
{
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'Password'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'Me');
$this->email->to('AnotherGuy');
$this->email->subject('This is an email test');
$this->email->message('It is working. Great!');
if($this->email->send())
{
echo 'Your email was sent.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
I am trying to figure out how to send emails using codeigniter, and I succesfully did so using my gmail account.
But the problem is that I do not known how to do it with my hotmail account...
Heres the code which uses gmail:
<?php
class Email extends CI_Controller
{
function index()
{
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'Password'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'Me');
$this->email->to('AnotherGuy');
$this->email->subject('This is an email test');
$this->email->message('It is working. Great!');
if($this->email->send())
{
echo 'Your email was sent.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用类似的代码,但正如前面提到的,您需要更改 smtp 变量。
热邮件:
服务器:smtp.live.com
端口:587
尝试:
来源
Use a similar code, but as was mentioned, you need to change the smtp variables.
Hotmail:
server:smtp.live.com
port:587
Try:
Source