【问题标题】:codeigniter : My emails are sending to spam on gmail [duplicate]codeigniter:我的电子邮件正在发送到 gmail 上的垃圾邮件 [重复]
【发布时间】:2020-10-12 00:40:10
【问题描述】:
                public function  booking() {
                        $this->load->helper(array('form'));
                        $this->load->library(array('session','email'));
                        $this->load->helper('string');
                        //$nwdb['wen_memid']        = $wen_memid         
      ='W'.random_string('alnum',3).'E'.random_string('alnum',3).'N';
                     $name      = $this->input->post('name');
                     $phone     = $this->input->post('phone');
                     $email         = $this->input->post('email');
                     $date  = $this->input->post('date');
                     $message   = $this->input->post('message');
                    

                        $config['protocol'] = 'sendmail';
                        $config['mailpath'] = '/usr/sbin/sendmail';
                        $config['charset'] = 'iso-8859-1';
                        $config['wordwrap'] = TRUE;
                        $config['mailtype'] = 'html';

                        $this->email->initialize($config);
                        $this->email->from('mail@gmail.com');
                        $this->email->to('mail@gmail.com');
                    
                        $this->email->subject('Appoinment Booking');
                        $this->email->message('<html>
                            <head>
                            </head>
                            <body>
                                    <H2>Contact Us</H2><br>
                                    <table rules="all" style="border:1px solid #7fb341;" 
    cellpadding="0">
                                    <tr style="background:#cddfb7;">
                                    <td> <strong>Name: </strong></td><td> '.$name.'</td></tr>
                                    <tr style="background:#cddfb7;">
                                    <td> <strong> Phone: </strong></td><td> '.$phone.'</td></tr>
                                    <td> <strong> Email: </strong></td><td> '.$email.'</td></tr>
                                    <tr style="background:#cddfb7;"><td><strong>Date :</strong></td> 
  <td>'.$date.'</td></tr>
                                    <tr style="background:#cddfb7;"><td><strong>Message:</strong> 
  </td><td>'.$message.'</td></tr>
                                    </table><br><br></body>

                            </html>
                            '); 
                            
                            
                        if ($this->email->send())
                        {
                            redirect('/welcome/bookonline');
                        }
                        else
                        {
                            //error
                            $this->session->set_flashdata('msg','<div class="alert alert-danger text- 
   center">There is error in sending mail! Please try again later</div>');
                            redirect('/');
                        }
                            
                    }

以上是我的控制器欢迎代码。欢迎/预订是控制器名称。该表格包含“姓名、电子邮件、日期、联系电话和消息”部分。我想将邮件发送到收件箱部分。我 不要为此使用 smtp。但是在这里,每封邮件都发送到垃圾邮件。请尽快帮助我。

【问题讨论】:

    标签: php codeigniter email controller email-spam


    【解决方案1】:

    我也有同样的问题 解决方案是让电子邮件不可疑,或使用一些第三方电子邮件,如 SendGrid 等,或按域设置您自己的邮件服务器或使用您自己的邮件服务器

    【讨论】:

      猜你喜欢
      • 2012-05-27
      • 2016-02-14
      • 2015-06-22
      • 1970-01-01
      • 2017-06-12
      • 2017-08-31
      • 1970-01-01
      • 2011-08-14
      • 1970-01-01
      相关资源
      最近更新 更多