【问题标题】:How to send email direct to gmail inbox not spam using codeigniter如何使用codeigniter将电子邮件直接发送到gmail收件箱而不是垃圾邮件
【发布时间】:2017-12-07 15:12:31
【问题描述】:

我想使用 codeigniter 将电子邮件发送到 gmail 收件箱而不是跨度。我编写了以下代码,但电子邮件发送到垃圾邮件而不是收件箱。

我的代码:

<?php
$this->load->library('email');

                        //SMTP & mail configuration
                $email = $this->input->post('email');
                        $config = array(
                            'protocol'  => 'tls',
                           // 'protocol'  => 'smtp',
                            'smtp_host' => 'ssl://smtp.googlemail.com',
                            'smtp_port' => 465,
                            'smtp_user' => 'mitesh.ebiztrait@gmail.com',
                            'smtp_pass' => '*****',
                            'mailtype'  => 'html',
                            'charset'   => 'utf-8',
                            'mailpath' => '/usr/sbin/sendmail',
                             'wordwrap' => TRUE,
                        );
                        $this->email->initialize($config);
                        $this->email->set_mailtype("html");
                        $this->email->set_newline("\r\n");


                        //Email content
                $data = 'http://52.14.24.245/upload/images/purchasedticket/'.$qrcode_image;

                $htmlContent .=  '<!DOCTYPE html>
                <html>
                <head>
                    <meta charset="utf-8">
                    <meta http-equiv="X-UA-Compatible" content="IE=edge">
                    <title> </title>
                    <link rel="stylesheet" href="">
                </head>
                <body> 
                    <p>Hi ,</p><br>
                    <strong>Payment for party ticket is successfull! </strong>

                    <p>Following is the QR Code, kindly present this QR code while you attend the party. </p>
                    <br>
                    URL : '.$data.'
                    <br>
                    <img src="'.$data.'"  / ><br />
                    <br>

                    Thanksbr, <br><br>
                    TheMove Team
                </body>
                </html>';
                        // $htmlContent = 'TheMove: party ticket purchase success!!';
                        // $htmlContent .= '<p>This email has sent via SMTP server from CodeIgniter application.</p>';

                        $this->email->to($email);
                        $this->email->from('ashvin.ebiztrait@gmail.com','Party App');
                        $this->email->subject('TheMove: party ticket purchase success!!');
                        $this->email->message($htmlContent);

                        //Send email
                        $data = $this->email->send();   
?>

如何将电子邮件直接发送到 gmail 收件箱而不是垃圾邮件?

【问题讨论】:

  • Gmail 告诉你为什么将邮件放入垃圾邮件文件夹,从那开始。
  • 你在这里发布你的凭据吗???
  • sigh 我已经从帖子中删除了密码。请立即更改您的密码。
  • 好的,但请帮助我如何将电子邮件发送到收件箱而不是垃圾邮件
  • 为了所有神圣的爱,请停止使用你的名字作为密码。

标签: php codeigniter


【解决方案1】:

确保电子邮件内容不那么像“垃圾邮件”。减少 HTML 和图像,确保您有足够的副本并通过一些在线验证器运行它。

看起来您在主题中使用了很多感叹号,来自字段是典型的垃圾邮件等等。这不是 CI 的问题,而是电子邮件副本的问题

【讨论】:

    【解决方案2】:

    检查您尝试通过电子邮件发送的所有变量和数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-27
      • 2018-03-16
      • 1970-01-01
      • 2017-06-12
      • 2011-10-28
      • 1970-01-01
      相关资源
      最近更新 更多