簡體   English   中英

在Codeigniter中使用hotmail發送電子郵件?

[英]Sending email with hotmail in Codeigniter?

我試圖弄清楚如何使用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' => '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());
    }
}

}

使用類似的代碼,但是如上所述,您需要更改smtp變量。 Hotmail:server:smtp.live.com端口:587

嘗試:

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

);

資源

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM