dqenv99518 2015-04-15 16:09
浏览 82

PHP中的脚本在填写表单后发送邮件

On the website of the local footballteam (enter link description here which is hosted by One.com, I programmed a soccer betting for the 8 matches of every matchday (8 matches). When the user has filled in the form and submit it, he recieves a mail with his betting and the webmaster receives a copy as Bcc. The mail is sent from the main mailbox of the domain doskobeveren.be: info@doskobeveren.be to the mail-address of the user.

Since the season 2013-2014 and the first 28 weeks of the season 2014-2015 the script has always worked fine (= 58 weeks). But since last week the Bcc part of the script gives for every mail a "Undelivered Mail Returned to Sender" in the main mailbox (info@doskobeveren.be) instead of the mailbox of the webmaster.

That mail says: Reporting-MTA: dns; mail-out2.one.com X-Postfix-Queue-ID: 9ABF0552A2 X-Postfix-Sender: rfc822; info@doskobeveren.be Arrival-Date: Wed, 15 Apr 2015 17:36:16 +0200 (CEST)

Final-Recipient: rfc822; webmaster@doskobeveren.be Original-Recipient: rfc822;webmaster@doskobeveren.be Action: failed Status: 5.7.1 Remote-MTA: dns; mxcluster2.one.com Diagnostic-Code: smtp; 550 5.7.1 Blocked by email filter

(27ec3383-e385-11e4-9d60-b82a72d88088)

The support of One.com tells me that these are the reasons:

  • Wrong Message-ID.
  • The used domainname is not correct.

Because the mail is made by the webpage, I wonder if the PHP-script causes, for wathever reason after the 58 weeks of good working, suddenly the problem?

The PHP comes from: enter link description here

enter code here
<h3>Dit bericht zal u per mail ontvangen:</h3>  
    <?php   
        $pronomail ='';
        $pronomail = $_SESSION['username']. ", u heeft de volgende pronostiek ingestuurd voor speeldag " .$speeldag. "

";

        for($i=1; $i<=8; $i++){
            $pronomail .=  "wedstrijd " .$i. ": " .$wedstrijd[$i]. " = ";
            switch ($i) {
                case 1:
                    $pronomail .= "Prono1: " .$k1w1. " - Prono2: " .$k2w1. " - Prono3: " .$k3w1. "

";
                    break;
                case 2:
                    $pronomail .= "Prono1: " .$k1w2. " - Prono2: " .$k2w2. " - Prono3: " .$k3w2. "

";
                    break;
                case 3:
                    $pronomail .= "Prono1: " .$k1w3. " - Prono2: " .$k2w3. " - Prono3: " .$k3w3. "

";
                    break;
                case 4:
                    $pronomail .= "Prono1: " .$k1w4. " - Prono2: " .$k2w4. " - Prono3: " .$k3w4. "

";
                    break;
                case 5:
                    $pronomail .= "Prono1: " .$k1w5. " - Prono2: " .$k2w5. " - Prono3: " .$k3w5. "

";
                    break;
                case 6:
                    $pronomail .= "Prono1: " .$k1w6. " - Prono2: " .$k2w6. " - Prono3: " .$k3w6. "

";
                    break;
                case 7:
                    $pronomail .= "Prono1: " .$k1w7. " - Prono2: " .$k2w7. " - Prono3: " .$k3w7. "

";
                    break;
                case 8:
                    $pronomail .= "Prono1: " .$k1w8. " - Prono2: " .$k2w8. " - Prono3: " .$k3w8. "

";
                    break;

            }

        }

        $pronomail .= " Veel succes! 

"; 
        $bericht =str_replace("
","<br />",$pronomail); 
        echo $bericht. "<br />";

        //define the receiver of the email
        $to = $_SESSION['email'];
        //define the subject of the email
        $subject = 'Pronostiek';
        //define the message to be sent. Each line should be separated with 

        $message = $pronomail;
        //define the headers we want passed. Note that they are separated with 

        $headers = "From: info@doskobeveren.be
Bcc: webmaster@doskobeveren.be
";
        $headers .= "Message-ID: <" . md5(uniqid(time())) . $_SERVER['SERVER_NAME']. ">
";
        $headers .= "MIME-Version: 1.0
";
        $headers .= "Date: ".date("D, d M Y H:i:s") . "
";
        //$headers .= "Reply-To: info@mydomain.com
";
        $headers .= "X-Priority: 3
X-MSMail-Priority: Normal
";
        $headers .= "X-Mailer: PHP/".phpversion()."
";
        $headers .= "X-MimeOLE: Produced By MyDomain
";
        $headers .= "Content-type: text/plain; charset=iso-8859-1
";         
        //$headers .= "Date: .date('r', $_SERVER['REQUEST_TIME'])
";
        //send the email
        $mail_sent = @mail( $to, $subject, $message, $headers );
        //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
        echo $mail_sent ? "Mail is verstuurd" : "Mail kon niet verstuurd worden";

?>

==========

Does someone can give me a solution please? Thanks.

  • 写回答

3条回答 默认 最新

  • doupa9062 2015-04-15 16:22
    关注

    The header fields are optional and really only needed if you want to custom tailor it. Comment out the line that's generating the Message-ID and it will probably pass the mail server's filtering system since it will generate a valid Message-ID itself.

    评论

报告相同问题?

悬赏问题

  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多