gpt4 book ai didi

php - 为什么我的 php 电子邮件脚本向我的垃圾邮件发送的电子邮件不在我的收件箱中?

转载 作者:行者123 更新时间:2023-11-29 00:42:17 24 4
gpt4 key购买 nike

下面是我的代码。当我点击“发送电子邮件”按钮时,它工作正常。但它没有出现在我的收件箱中......它被路由到垃圾邮件文件夹。

<?php require_once "../session.php" ?>
<?php
$host='localhost'; // My hostname
$username='root'; // Mysql username
$password='*********'; // Mysql password
$db_name='jobs'; // DB name

mysql_connect($host, $username, $password)or die("Cannot Connect");
mysql_select_db($db_name);
if (isset($_POST['action']) && $_POST['action'] == "SEND CV NOW") {
$firstname = $_POST['firstname'];
$surname = $_POST['lastname'];
$email = $_POST['email'];

$sql = "SELECT JobTitle,JobID FROM tblebjobs WHERE ID='".$_GET['id']."'";
$result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error());
if (!$result) {
die('Invalid query: ' . mysql_error() . '<br />'. $insertstatement);
}
$details = mysql_fetch_row($result);

//upload cv first
if(!isset($_FILES['cv'])) {
$err = "You forgot to select a CV to upload";
}
$cvname = basename(stripslashes($_FILES['cv']['name']));

if(empty($cvname)){
$err = "The name of the attachment was not found.";
}

if(empty($err)){
$newcv = "tempcv/".$cvname;
$result = @move_uploaded_file($_FILES['cv']['tmp_name'], $newcv);
if(empty($result)){
$err = "There was an error moving the uploaded cv please try again if it continues to file please call us directly.";
} else {
//increment by 1
$sql3 = "update `emp_record` set `total_app`=`total_app` + 1 WHERE username='".$_SESSION['name']."'";
$result3 = mysql_query($sql3) or die ("Could not insert data into DB: " . mysql_error());
$sql2 = "update `tblebjobs` set `total_app`=`total_app` + 1 WHERE ID='".$_GET['id']."'";
$result2 = mysql_query($sql2) or die ("Could not insert data into DB: " . mysql_error());

//create random for boundry
$random_hash = md5(date('r', time()));
//set email headers
$headers = "Return-path: <".$email.">"."\r\n";
$headers .= "Reply-to: <".$email.""."\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"\r\n";
$headers .= "From: ".$email." <".$email.">"."\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: E-borders.net web site\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "\r\n\r\n";
//setup message and include $body previously prepped
$prebody = "--PHP-mixed-{$random_hash}\r\n";
$prebody .="Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$prebody .="Content-Transfer-Encoding: 7bit\r\n";
$prebody .="\r\n";
$prebody .="A CV has been submitted from the website the CV is attached to this email and the details of the form submission are below.<br /><br />";
$prebody .="{$firstname} {$surname}<br />";
$prebody .="{$email}<br />";
$prebody .="\r\n";
$prebody .="--PHP-mixed-{$random_hash}\r\n";
// prep attachments
$data = chunk_split(base64_encode(file_get_contents($newcv)));
$prebody .= "Content-Type: application/pdf; name=\"{$newcv}\"\r\n";
$prebody .= "Content-Disposition: attachment; filename=\"{$newcv}\"\r\n";
$prebody .= "Content-Transfer-Encoding: base64\r\n\r\n";
$prebody .= "{$data}\r\n\r\n";
$prebody .= "--PHP-mixed-{$random_hash}\r\n";
$prebody .= "\r\n";
//set to address
$to = 'jtcompanero@yahoo.com';
//set subject
$subject = "CV FROM: {$details[0]} ({$details[1]})";
// Mail it
mail($to, $subject, $prebody, $headers);
unlink($newcv);
$err = "Your CV has been submitted we will be in touch shortly";
}
}
}
?>

<u><strong>Apply Online</strong></u>
<?php if (isset($err)) {
echo "<div style=\"text-align:center;color:red;font-weight:bold;\">$err</div>";
}?>
<p>
<form method="POST" action="apply.php?id=<?php echo $_GET['id'];?>" enctype="multipart/form-data">
<table border="0" cellpadding="5" cellspacing="0" align="center">
<tr><td>First name:</td><td><input type="text" name="firstname" id="firstname"></td></tr>
<tr><td>Last name:</td><td><input type="text" name="lastname" id+"lastname"></td></tr>
<tr><td>Email Address:</td><td><input type="text" name="email" id="email"></td></tr>
<tr><td>Path to CV:</td><td><input type="file" name="cv" id="cv" /></td></tr>
</table>
<p align=center>
<input type="submit" name="action" id="action" value="SEND CV NOW">
</p>
</form>
</p>
</div>

此外...我这里有简历附件。但是文件也没有添加到消息中。

最佳答案

它与电子邮件的内容有关(在正文中或标题中)。不是实际的 php 代码本身。

垃圾邮件过滤器的工作方式各不相同,因此我们无法为您提供特定的解决方案。

注意:尝试使用类似 http://swiftmailer.org/ 的邮件组件发送您的电子邮件,而不是用一个大字符串来构造它们。

关于php - 为什么我的 php 电子邮件脚本向我的垃圾邮件发送的电子邮件不在我的收件箱中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11788622/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com