【发布时间】:2022-02-10 21:08:15
【问题描述】:
我终于找到了一个有效的联系表格 - 将它插入我的三个站点,现在问题是我每天都收到来自我自己的网络托管服务器 Ionos 的所有三个站点的垃圾邮件,毫无意义的邮件(屏幕截图)。
我联系了 Ionos:“这是一个从网络空间发送电子邮件的邮件功能,需要停止发送添加的电子邮件的脚本。”
我问如何阻止它,答案是:“脚本不在我们的支持范围内”,这很丰富,来自一个网络托管站点。
'发送邮件'php。
<?php
/*
This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
*/
$webmaster_email = "legion@naturalblood.co";
/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
$feedback_page = "feedback_form.html";
$error_page = "error_message.html";
$thankyou_page = "thank_you.html";
/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$email_address = $_REQUEST['email_address'] ;
$comments = $_REQUEST['comments'] ;
$first_name = $_REQUEST['first_name'] ;
$msg =
"First Name: " . $first_name . "\r\n" .
"Email: " . $email_address . "\r\n" .
"Comments: " . $comments ;
/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}
// If the form fields are empty, redirect to the error page.
elseif (empty($first_name) || empty($email_address)) {
header( "Location: $error_page" );
}
/*
If email injection is detected, redirect to the error page.
If you add a form field, you should add it here.
*/
elseif ( isInjected($email_address) || isInjected($first_name) || isInjected($comments) ) {
header( "Location: $error_page" );
}
// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( "$webmaster_email", "Message from amatoria.com", $msg );
header( "Location: $thankyou_page" );
}
?>
【问题讨论】:
-
他们说脚本不在他们的支持范围内,他们并不丰富。他们做网络托管,而不是编程。
-
@Dokik 如果我支付 Ionos Premium 以获得托管网站的特权,那么我应该期望支持停止从 Ionos 发送垃圾 - 一些代码的帮助不应该超出他们的范围。如果你只能用你自己的垃圾来回答我的问题,那么我建议堆栈溢出不适合你。
-
我现在不太明白,你是说 ionos 正在发送垃圾邮件?我看到的方式是你从你自己的网页上用你自己的表格收到垃圾邮件。还是你使用了 ionos 的函数?
-
看邮件截图:发件人是Ionos - 'name: 1, email: 1, cmets: 1.'这是垃圾。我不能简单地将它过滤到垃圾箱,因为真正的电子邮件是通过这个地址发送的。