|
在 source/function/function_mail.php 里找到 function sendmail($toemail, $subject, $message, $from = '')
在 sendmail() 函数内添加:
$user_ip = $_SERVER['REMOTE_ADDR'];
$allowed_countries = array('CN', 'JP');
$ip_info = json_decode(file_get_contents("http://ip-api.com/json/{$user_ip}?fields=countryCode"), true);
if (!in_array($ip_info['countryCode'], $allowed_countries)) {
return false; // 禁止发送邮件
}
----------------------------------------------域名---------------------------------------
function sendmail($toemail, $subject, $message, $from = '') {
global $_G;
// 黑名单邮件域名
$blacklist_domains = array('1tetris.ru', 'example.com', 'spamdomain.net');
// 提取收件人邮箱的域名
$email_domain = substr(strrchr($toemail, "@"), 1);
// 如果域名在黑名单中,则不发送邮件
if (in_array($email_domain, $blacklist_domains)) {
return false; // 直接返回,不发送邮件
}
// 继续执行原始的邮件发送逻辑 ...
}
|
|