简体   繁体   English

CodeIgniter中的SMTP邮件错误

[英]SMTP mail error in CodeIgniter

While sending mail using CodeIgniter - SMTP shows the following error.But the mail is reaching at destination. 使用CodeIgniter发送邮件时-SMTP显示以下错误。但是邮件到达目的地。 Because of error I can't display the custom message at the client side. 由于错误,我无法在客户端显示自定义消息。 I contacted with the server side team but they told me that the issue with in my code. 我与服务器端团队联系,但他们告诉我代码中的问题。 But I couldn't find anything. 但是我什么也找不到。

It is a HTML type mail 这是HTML类型的邮件

My code shown below 我的代码如下所示

$from_mail = "contest@mytechnopark.in";
$subject = "My Technopark Contest - ".$contest_title;
$to_mail = trim($user_mail);//$data['user_mail'];
$mail_template = '<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My Technopark</title>
</head>
<body>
<table width="600" align="center">
    <tbody>
        <tr>
            <td style="font-size:18px;color:#000;font-family:Arial;"><br>
                <span style="font-size:18px;font-family:Arial;font-weight:100; line-height:22px;">
                    <p><img src="http://www.mytechnopark.in/email-temp/xmas.jpg"> </p>
                    <p><h4><strong> Hai '.$user_name.',</strong></h4></p>
                </span>
                <p>
                    <h4><strong>Thanks and Regards,</strong></h4>
                </p>
                <h4><strong> Team</strong></h4>
                </span>
            </td>
        </tr>
        <tr>
            <td style="font-family:Arial;font-size:13px; text-align:center; color:#666; padding:6px 0; background:#ccc" >
            </td>
        </tr>
    </tbody>
</table>
</body>
</html>';

    $this->load->library('email');

    $config['protocol']    = 'smtp';

    $config['smtp_host']    = 'mail.mypark.in';

    $config['smtp_port']    = '25';

    $config['smtp_timeout'] = '7';

    $config['smtp_user']    = 'info@mypark.in';

    $config['smtp_pass']    = '**************';

    $config['charset']    = 'utf-8';

    $config['newline']    = "\r\n";

    $config['mailtype'] = 'html'; // or html

    $config['validation'] = TRUE; // bool whether to validate email or not      

    $this->email->initialize($config);

    $this->email->set_newline("\r\n");


    $this->email->from($from_mail,'Title');
    $this->email->to($to_mail);
    $this->email->subject($subject);
    $this->email->message($mail_template);
    $this->email->set_mailtype('html');



    if($this->email->send()){

        $result = $this->Contest_Model->send_email_db($apply_id);
        json_encode($this->response($result,200));

    }else{

        echo $this->email->print_debugger();
        json_encode($this->response(array("result"=>0,"message"=>"Mail sent failed"),200));

    }

Error Shown Below 错误显示如下

220-cp-34.webhostbox.net ESMTP Exim 4.89 #1 Fri, 22 Dec 2017 04:08:47 +0000 
220-We do not authorize the use of this system to transport unsolicited, 
220 and/or bulk e-mail.
<br /><pre>hello: 250-cp-34.webhostbox.net Hello www.mypark.in [127.0.0.1]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
</pre><pre>from: 250 OK
</pre><pre>to: 250 Accepted
</pre><pre>data: 354 Enter message, ending with "." on a line by itself
</pre><br /><pre>quit: 250 OK id=1eSEdb-001tEE-Hg
</pre>The following SMTP error was encountered: 250 OK id=1eSEdb-001tEE-Hg
<br />The following SMTP error was encountered: <br />Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.<br /><pre>Date: Fri, 22 Dec 2017 09:38:47 +0530
From: &quot;My park&quot; &lt;info@mypark.in&gt;
Return-Path: &lt;info@mypark.in&gt;
To: rahul.pra@gmail.com
Subject: =?UTF-8?Q?Thank=20you?=
Reply-To: &lt;info@mypark.in&gt;
User-Agent: CodeIgniter
X-Sender: info@mytpark.in
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: &lt;5a3c854f7f5ad@mypark.in&gt;
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary=&quot;B_ALT_5a3c854f7f602&quot;

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

--B_ALT_5a3c854f7f602
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hai Jijith,


 Regards,
 Team Mypark

This example for smtp works in 2017 and sends email using SMTP smtp的此示例在2017年可用,并使用SMTP发送电子邮件

https://github.com/dataf3l/curso-php-2017/blob/master/contact-form/mail.php https://github.com/dataf3l/curso-php-2017/blob/master/contact-form/mail.php

Consider modifying your php.ini and setting up the mail items. 考虑修改您的php.ini并设置邮件项目。

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

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