发送空白电子邮件

时间:2019-11-28 12:10:35

标签: javascript php html post

填写表格后它可以正常工作,但是它还会随机发送数百封空白电子邮件。我不知道问题可能在哪里。它仅发送空白电子邮件。请帮助我修复它!谢谢

这是PHP代码:

ToList()

1 个答案:

答案 0 :(得分:0)

嘿,请尝试以下代码:

if(isset($_POST['name']) != "" && isset($_POST['designation']) && isset($_POST['datehired']) && isset($_POST['dateperiod'])) {

$emailSubject = "6 Months Performance Evaluation for ".$_POST['name'];
    $weBMaster = '#';

    $employeeName = $_POST['name']; 
    $designationName = $_POST['designation'];
    $accountDept = $_POST['account'];
    $dateHired = $_POST['datehired'];
    $datePeriod = $_POST['dateperiod'];
    $evalname = $_POST['nameevaluator'];
    $evalDesignation = $_POST['evaluatordesignation'];
    $job_knowledge = $_POST['job_knowledge'];
    $job_knowledge_comment = $_POST['job_knowledge_comment'];

    $body = <<<EOD

<h2>6 Months Performance Evaluation for $employeeName $datePeriod </h2><br><hr><br>
<h3>Employee Data</h3>
Name: $employeeName<br>
Designation: $designationName<br>
Account/Dept: $accountDept<br>
Date Hired: $dateHired<br>
For the Period of: $datePeriod <br>
<h3>Evaluator</h3>
Evaluator: $evalname<br>
Designation: $evalDesignation<br>
<h3>Ratings</h3>
1. Job Knowledge: $job_knowledge <br> 
Measures employee's demonstrated job relevant knowledge and essential skills, such as work practices, policies, procedures, resources, laws, customer service, and technical information, as well as the relationship of work to the organization's mission. <br>
Comment: $job_knowledge_comment <br><br>

EOD;

    $headers = "From: #\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($weBMaster,$emailSubject, $body, $headers);

$theresults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Evaluation Form</title>
</head>
<body>
<meta http-equiv="refresh" content="0; url=#" />
</body>
</html>
EOD;
echo "$theresults";
}
?>