简体   繁体   English

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

[英]Sending email with hotmail in Codeigniter?

I am trying to figure out how to send emails using codeigniter, and I succesfully did so using my gmail account. 我试图弄清楚如何使用codeigniter发送电子邮件,并且成功使用了我的gmail帐户。

But the problem is that I do not known how to do it with my hotmail account... 但是问题是我不知道如何使用我的hotmail帐户来执行此操作...

Heres the code which uses gmail: 这是使用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("\r\n");

    $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());
    }
}

} }

Use a similar code, but as was mentioned, you need to change the smtp variables. 使用类似的代码,但是如上所述,您需要更改smtp变量。 Hotmail: server:smtp.live.com port:587 Hotmail:server:smtp.live.com端口:587

Try: 尝试:

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

);

Source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM