Php 即使成功投递,也不接收邮件

Php 即使成功投递,也不接收邮件,php,email,Php,Email,我有一个有效的邮件脚本,我以前测试过 现在,突然间,用同样的代码,我没有收到任何邮件,其他人也没有 我在outlook和gmail上查看了垃圾邮件和收件箱 这是我的邮件脚本: <?PHP require_once ('config.php'); require_once("../phpMailer/class.phpmailer.php"); $isValid = true; if(isset($_POST['name']) && isset($_POST['subject

我有一个有效的邮件脚本,我以前测试过

现在,突然间,用同样的代码,我没有收到任何邮件,其他人也没有

我在outlook和gmail上查看了垃圾邮件和收件箱

这是我的邮件脚本:

<?PHP
require_once ('config.php');
require_once("../phpMailer/class.phpmailer.php");
$isValid = true;
if(isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['email']) && isset($_POST['message'])) 
{
    $name = $_POST['name'];
    $subject = 'Er is een contact aanvraag op Kijk & Zie : '.$_POST['subject'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $phone = $_POST['phone'];
    $mail = new PHPMailer;
    $mail->From = $email;
    $mail->FromName = $name;
    $mail->addAddress("receiver@live.nl");   // Add a recipient
    $mail->isHTML(true);                      // Set email format to HTML
    $mail->Subject = $subject;
    $texts = 'Er is een aanvraag op de website van Kijk & Zie<br /> <br />
    <b>Naam:</b> '.$name.'<br />
    <b>E-mail adres:</b> '.$email.'<br />
    <b>Onderwerp:</b> '.$subject.'<br />
    <b>Telefoonnummer:</b>'.$phone.'<br />
    <b>Vragen / Opmerkingen:</b> '.$message.'<br /><br /><br />
    ';

    $handtekening = '
    <table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-family:calibri;color: #5C5C5C; font-size:10pt;line-height:22px;">
    <tr>
    <td width="160" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;">
    [contents]
    </td>
    </tr>
    <tr>
    <td width="160" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;">
    <br><br>Met vriendelijke groet,<br><br>
    Helpdesk<br>
    <b>Kijk & Zie</b><br>
    <p></p>
    </td>
    </tr>
    </table>
    <table height="120" border="0" width="100%" cellspacing="0" cellpadding="0" style="font-family:calibri;color: #5C5C5C; font-size:10pt;line-height:22px;">
    <tr>
    <td width="250" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;border-top: 1px #000000 dotted; border-bottom: 1px #000000 dotted;">
    E:&nbsp;&nbsp;
    <a href="mailto:info@website.nl" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;">info@website.nl</a><br>
    T:&nbsp;&nbsp;
    <a href="tel:0181851859" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;">(0181) 851 859</a><br>
    W:&nbsp;&nbsp;
    <a href="http://website.nl" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;" target="_blank">www.website.nl</a><br>
    </td>
    <td align="right" style="font-family:calibri;padding-right:10px;padding-top:5px;border-top: 1px #000000 dotted; border-bottom: 1px #000000 dotted;">
    <a href="http://website.nl/" target="_blank" title="Ga naar de website">
    <img src="http://www.website-kindercoaching.nl" alt="Ga naar de website" style="font-family:calibri;text-align:right;margin:0px;padding:10px 0 10px 0;" border="0" width="232">
    </a>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="font-family:calibri;color:#a3a3a3;font-size:11px;margin-top:6px;line-height:14px;">
    <br>Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde. Als dit bericht niet voor u bestemd is, wordt u vriendelijk verzocht dit aan de afzender te melden. Kijk & Zie staat door de elektronische verzending van dit bericht niet in voor de juiste en volledige overbrenging van de inhoud, noch voor tijdige ontvangst daarvan. Voor informatie over Kijk & Zie raadpleegt u <a href="http://website-kindercoaching.nl" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;" target="_BLANK">Kijk & Zie</a>.<br><br>
    </td>
    </tr>
    </table>';

    $contents = preg_replace('/\[contents]/',$texts, $handtekening);
    $mail->msgHTML($contents);
    $mail->AltBody = $texts;
    if(!$mail->send()) 
    {
        $isValid = false;
    }

    $mail = new PHPMailer;
    $mail->From = 'info@website.nl';
    $mail->FromName = 'Kijk & Zie';
    $mail->addAddress($email);     // Add a recipient
    $mail->isHTML(true);           // Set email format to HTML
    $mail->Subject = 'Bedankt voor uw aanvraag bij Kijk & Zie';
    $texts = 'Geachte heer/mevrouw '.$naam.',<br /><br />
    Hartelijk dank voor uw aanvraag bij Kijk & Zie<br />
    Wij reageren zo spoedig mogelijk op uw aanvraag.<br /><br />
    Uw gegevens worden nooit aan derden ter hand gesteld.
    ';
    $contents = preg_replace('/\[contents]/',$texts, $handtekening);
    $mail->msgHTML($contents);
    $mail->AltBody = $texts;
    if(!$mail->send()) 
        $isValid = false;
    }
    if($isValid == true) {
        $result["submit_message"] = _msg_send_ok;
    } else {
        $result["submit_message"] = _msg_send_error;
    }

    $array = array(
    'isValid' => $isValid
    );

    echo json_encode($result);
是什么阻止了我接收/发送电子邮件


当我提交表单时,它会给我一条成功消息,在服务器日志中我可以看到它已成功发布

也许你只是被邮件提供商阻止了,你可以使用其他域上的电子邮件地址吗?如果代码没有更改,问题不在于你确认(可能只发送了1封普通的测试邮件)你可以用PHP邮件发送邮件了吗?@Svetlio不再。我以前用相同的代码测试过这个脚本,但现在我再也没有收到任何代码了。我只测试了3-4次,所以我认为邮件提供商不会因此而阻止你。但也许我不小心按下了ctrl+z's键。它以前工作过,并且它确实发布了表单,我可以在服务器日志中看到它。@t尝试创建另一个php文件,只向您的收件箱发送一封测试邮件,与当前逻辑无关。。邮件问题通常与逻辑无关,而是与邮件发送过程本身有关。。
//contact form
    if($(".contact-form").length)
    {
        $(".contact-form").each(function(){
            $(this)[0].reset();
        });
        $(".submit-contact-form").on("click", function(event){
            event.preventDefault();
            $("#contact-form").submit();
        });
    }
    $(".contact-form").submit(function(event){
        event.preventDefault();
        var data = $(this).serializeArray();
        var self = $(this);
        //if($(this).find(".total-cost").length)
        //  data.push({name: 'total-cost', value: $(this).find(".total-cost").val()});
        self.find(".block").block({
            message: false,
            overlayCSS: {
                opacity:'0.3',
                "backgroundColor": "#FFF"
            }
        });

        $.ajax({
            url: self.attr("action"),
            data: data,
            type: "post",
            dataType: "json",
            success: function(json){
                self.find(".submit-contact-form, [name='submit'], [name='name'], [name='email'], [name='message']").qtip('destroy');
                if(typeof(json.isOk)!="undefined" && json.isOk)
                {
                    if(typeof(json.submit_message)!="undefined" && json.submit_message!="")
                    {
                        self.find(".submit-contact-form").qtip(
                        {
                            style: {
                                classes: 'ui-tooltip-success'
                            },
                            content: { 
                                text: json.submit_message 
                            },
                            position: { 
                                my: "right center",
                                at: "left center" 
                            }
                        }).qtip('show');
                        self[0].reset();
                        self.find(".cost-slider-input").trigger("change");
                        self.find(".cost-dropdown").selectmenu("refresh");
                        self.find("input[type='text'], textarea").trigger("focus").trigger("blur");
                    }
                }
                else
                {
                    if(typeof(json.submit_message)!="undefined" && json.submit_message!="")
                    {
                        self.find(".submit-contact-form").qtip(
                        {
                            style: {
                                classes: 'ui-tooltip-error'
                            },
                            content: { 
                                text: json.submit_message 
                            },
                            position: { 
                                my: "right center",
                                at: "left center" 
                            }
                        }).qtip('show');
                    }
                    if(typeof(json.error_name)!="undefined" && json.error_name!="")
                    {
                        self.find("[name='name']").qtip(
                        {
                            style: {
                                classes: 'ui-tooltip-error'
                            },
                            content: { 
                                text: json.error_name 
                            },
                            position: { 
                                my: "bottom center",
                                at: "top center" 
                            }
                        }).qtip('show');
                    }
                    if(typeof(json.error_email)!="undefined" && json.error_email!="")
                    {
                        self.find("[name='email']").qtip(
                        {
                            style: {
                                classes: 'ui-tooltip-error'
                            },
                            content: { 
                                text: json.error_email 
                            },
                            position: { 
                                my: "bottom center",
                                at: "top center" 
                            }
                        }).qtip('show');
                    }
                    if(typeof(json.error_message)!="undefined" && json.error_message!="")
                    {
                        self.find("[name='message']").qtip(
                        {
                            style: {
                                classes: 'ui-tooltip-error'
                            },
                            content: { 
                                text: json.error_message 
                            },
                            position: { 
                                my: "bottom center",
                                at: "top center" 
                            }
                        }).qtip('show');
                    }
                }
                self.find(".block").unblock();
            }
        });
    });