php
  • email
  • hyperlink
  • dns
  • gmail
  • 2017-09-06 26 views 0 likes 
    0

    以下是我使用codeigniter發送郵件的功能。只有使用鏈接有問題,我測試了其他所有東西。如果我刪除鏈接或使用域名郵件進入收件箱。如果我在我的郵件正文中包含我的域名鏈接,則使用PHP codeigniter發送郵件僅對gmail發送垃圾郵件

    public function send_notification() 
    { 
        $body = "<div style='width:100%; margin:0 auto;'> 
             <table style='background-color:#ffffff;padding:0 10px; width:100%;box-shadow: 0px 0px 4px #263b91;'> 
              <tr> 
               <td style='text-align:center;'> 
                <a href='https://example.com'><b>Click Here</b></a> 
               </td> 
              </tr> 
              <!-- mail body --> 
              <tr> 
               <td> 
                <p style='width:100%;'> 
                 <h4>Message</h4> 
                </p> 
               </td> 
              </tr> 
             </table> 
             <!-- footer --> 
             <table style='width:100%;background-color:#8dc440;box-shadow: 0px 2px 3px 0px #000;'> 
              <tr> 
               <td> 
                <p style='font-size:14px; text-align:center;'> 
                 <small>&copy; 2017 All Rights Reserved</small> 
                </p> 
               </td> 
              </tr> 
             </table> 
            </div>";    
         $subject = "Notification from Example"; 
         $config['protocol']  = $this->config->item('protocol'); // 'smtp' 
         $config['smtp_host'] = $this->config->item('smtp_host'); //mail.example.com 
         $config['smtp_port'] = $this->config->item('smtp_port'); //25 
         $config['smtp_timeout'] = $this->config->item('smtp_timeout'); //7 
         $config['smtp_user'] = $this->config->item('smtp_user'); [email protected] 
         $config['smtp_pass'] = $this->config->item('smtp_pass'); 
         $config['charset']  = $this->config->item('charset'); utf-8 
         $config['newline']  = $this->config->item('newline'); \n\r 
         $config['mailtype']  = 'html'; // or text 
         $config['validation'] = TRUE; // bool whether to validate email or not  
         $this->email->initialize($config); 
         $this->email->from('[email protected]','Exaple'); 
         $this->email->to('[email protected]'); 
         $this->email->subject($subject); 
         $this->email->message($body); 
         $this->email->send(); 
    } 
    
    +0

    你可以使用[郵件測試工具(https://www.mail-tester.com/)檢查存在哪些問題並將結果編輯爲您的問題。這可能有助於獲得答案。 –

    回答

    -1

    這是沒有確定的射擊技巧。嘗試指定所有類型的標題。

    例如:

    $headers .= "Reply-To: The Sender <[email protected]>\r\n"; 
        $headers .= "Return-Path: The Sender <[email protected]>\r\n"; 
        $headers .= "From: The Sender <[email protected]>\ 
        $headers .= "Organization: Sender Organization\r\n"; 
        $headers .= "MIME-Version: 1.0\r\n"; 
        $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
        $headers .= "X-Priority: 3\r\n"; 
        $headers .= "X-Mailer: PHP". phpversion() ."\r\n" 
    

    而且還檢查了 'SpamAssassin分數'

    +1

    不,這是無稽之談。包含這些頭文件不會改善您的郵件傳遞能力。其中一些實際上可能會使情況變得更糟 - 例如,如果某些版本的SpamAssassin包含(虛假和實際上未使用的)「X-Priority」標頭,則它們更可能將郵件標記爲垃圾郵件。 – duskwuff

    +0

    謝謝Sucharitha,但是我對頭文件沒有任何問題。我還找到了使用谷歌縮短網址的解決方案。但它不起作用,以防我想在我的郵件正文中添加圖像。 – user3355690

    +0

    ** Google Shorten URL **解決了我的問題。我用谷歌短網址也添加圖片。所以現在我的郵件也不會在垃圾郵件中用於Gmail。 – user3355690

    相關問題