簡體   English   中英

從聯系表單中獲取偶爾發送的空白電子郵件

[英]Getting occasional blank emails sent from contact form

我的網站是www.photograsurfer.com,在過去的幾個月中,偶爾會有3次左右,我會從我的聯系表中收到一封沒有任何信息的電子郵件。

我正在使用驗證,因此我認為不填寫信息就無法發送表格。 我已經對表格進行了多次測試,沒有任何問題,但是我擔心聯系表格可能有問題。

最新的電子郵件說這是一個未知發件人,“通過web2000.websitewelcome.com”

<?php

// PHP parameters
$sendto = "jefe.damron@gmail.com";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

// Subject
$email_subject = $_POST['name'] . ' ' . 'is contacting you from Photograsurfer.com' . '!';


// body of email
$body = "
<html>
<head>

<style type='text/css'>

        body{
            width: 500px;
            font-size: 1em;
            letter-spacing: .1em;
            color: rgb(166,166,166);
        }

        li {
            list-style: none;
            padding: 5px 0px 0px 5px;
            font-size: 1.350em;
            background-color: rgb(230,230,230);
            margin-left: 5px;
        }

        ol {
            padding: 5px 0 5px 30px;
            background-color: rgb(245,245,245);
            margin-top: 0;
            margin-left: 5px;
            font-size: 1.15em;
        }

</style>

</head>
<body>

<div>

    <ul>

        <li>Name:</li>
            <ol>- $name</ol>

        <li>Email:</li>
            <ol>- $email</ol>

        <li>Message:</li>
            <ol>- $message</ol>

    </ul>

</div>


</body>
</html>
";

$body = wordwrap($body, 60, "\n");

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: $email";

// Mail it
  mail( $sendto, $email_subject, $body, $headers );
?>

$(document).ready(function () {

    $("#contactform").validate({
        rules: {
            name: {
                required: true,
                minlength: 2
            },
            email: {
                required: true,
                email: true
            },
            message: {
                required: true,
                minlength: 10
            },
        },
        messages: {
            name: {
                required: "*Please enter your name.",
                minlength: "*Your name must consist of at least 2 characters."
            },
                email: "*Please enter a valid email address.",
                message: "*Please, say something at least 10 characters long.",
        },

        submitHandler: function(form) {
            $('#submitemail').hide();
            $("#contactform li.buttons").append('<img src="http://www.photograsurfer.com/media/loading.gif" alt="Loading" id="loading" />');
            $.post('http://www.photograsurfer.com/code/submitcontactform.php',
            $('form#contactform').serialize());

            setTimeout( function() {
                $("#contactform").slideUp("normal", function() {                   
                $("#contactform").before('<img src="http://www.photograsurfer.com/media/contact_thankyou.png" alt="Thank You" id="thankyou" />');

                })
            },2000);

            return false;
        }
        })
        return false;
});

<form id="contactform" method="post">
        <ol class="forms">
            <fieldset>
                <label for="name"><input type="text" name="name" id="name" value="" placeholder="Name:" required minlength="2" /></label>
            </fieldset>
                <p style="margin-top: -15px;"><label for="name" class="error"></label></p> 
            <fieldset>
                <label for="email"><input type="text" name="email" id="email" value="" placeholder="Email:" required /></label>
            </fieldset>
                <p style="margin-top: -15px;"><label for="email" class="error"></label></p>           
            <fieldset>
                <label for="message"><textarea name="message" id="message" placeholder="Question/Comments:" required ></textarea></label>
            </fieldset>
                <p style="margin-top: -10px;"><label for="message" class="error"></label></p>            
            <li class="buttons"><button type="submit" id="submitemail">Send Email &raquo;</button><input type="hidden" name="submitted" id="submitted" value="true" /></li>

        </ol>
    </form>

有任何想法嗎? 謝謝!

if (!isset($_REQUEST['name']) || !isset($_REQUEST['email']) || !isset($_REQUEST['message'])) {
  die();
}

// PHP parameters

將此檢查添加到腳本頂部。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM