duande3134 2013-11-06 14:18
浏览 68
已采纳

我如何从codeigniter发送电子邮件

i using this code to send testing email, but i always facing error, what should i have to do ?

//==========code======================

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'localhost',
        'smtp_port' => 25,

        'smtp_user' => 'root',

        'smtp_pass' => '', 

        'mailtype' => 'html',

        'charset' => 'iso-8859-1',
        'wordwrap' => TRUE
);

$message = ' hello world';
$this->load->library('email', $config);
$this->email->set_newline("
");
$this->email->from('xxxxx@live.com'); 
$this->email->to('xxxxx@live.com');
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if($this->email->send())
{
        echo 'Email sent.';
}
else
{
        show_error($this->email->print_debugger());
}

Error from CodeIgniter:

 An Error Was Encountered


    The following SMTP error was encountered: 10061 No connection could be made because 

    the target machine actively refused it. 




    Unable to send data: AUTH LOGIN
    Failed to send AUTH LOGIN command. Error: 


    Unable to send data: MAIL FROM:


    from: 
    The following SMTP error was encountered: 
    Unable to send data: RCPT TO:
    to: 
    The following SMTP error was encountered: 
    Unable to send data: DATA
    data: 
    The following SMTP error was encountered: 
    Unable to send data: User-Agent: CodeIgniter Date: Wed, 6 Nov 2013 13:50:31 +0000 From: Return-Path: To: xxxx@live.com Subject: =?iso-8859-1?Q?Resume_from_JobsBuddy_for_your_Job_posting?= Reply-To: "xxxx@live.com" X-Sender: 


xxx@live.com X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: 


<527a492796d84@live.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_527a492796d84" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_527a492796d84 Content-Type: text/plain; 


charset=iso-8859-1 Content-Transfer-Encoding: 8bit hello world --B_ALT_527a492796d84 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable hello world --B_ALT_527a492796d84--
        Unable to send data: .

        The following SMTP error was encountered: 
        Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

    User-Agent: CodeIgniter


    Date: Wed, 6 Nov 2013 13:50:31 +0000
    From: 


    Return-Path: 
    To: xxx@live.com


    Subject: =?iso-8859-1?Q?Resume_from_JobsBuddy_for_your_Job_posting?=
    Reply-To: "xxx@live.com" 
    X-Sender: xxx@live.com
    X-Mailer: CodeIgniter
    X-Priority: 3 (Normal)
    Message-ID: <527a492796d84@live.com>
    Mime-Version: 1.0


    Content-Type: multipart/alternative; boundary="B_ALT_527a492796d84"

    This is a multi-part message in MIME format.
    Your email application may not support this format.



    --B_ALT_527a492796d84


    Content-Type: text/plain; charset=iso-8859-1


    Content-Transfer-Encoding: 8bit

    hello world


    --B_ALT_527a492796d84
    Content-Type: text/html; charset=iso-8859-1


    Content-Transfer-Encoding: quoted-printable

     hello world

    --B_ALT_527a492796d84--
  • 写回答

3条回答 默认 最新

  • dongyi1982 2013-11-06 14:21
    关注

    Unable to send data: AUTH LOGIN Failed to send AUTH LOGIN command. Error: ---- Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

    1. Make sure that the SMPT parameters are correct
    2. Make sure that your server has SMTP service running
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog