dongsuikai8286 2011-10-29 17:10 采纳率: 100%
浏览 59

在Codeigniter中使用hotmail发送电子邮件?

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' => 'someEmail@gmail.com',
        'smtp_pass' => 'Password'

    );
    $this->load->library('email', $config);
    $this->email->set_newline("
");

    $this->email->from('someEmail@gmail.com', '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());
    }
}

}

  • 写回答

1条回答 默认 最新

  • dongshanya2008 2011-11-16 22:51
    关注

    Use a similar code, but as was mentioned, you need to change the smtp variables. Hotmail: server:smtp.live.com port:587

    Try:

    $config = array(
        'protocol' => 'smtp', 
        'smtp_host' => 'ssl://smtp.live.com',
        'smtp_port' => 587,
        'smtp_user' => 'someEmail@gmail.com',
        'smtp_pass' => 'Password'
    
    );
    

    Source

    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试