prod to stage
# Conflicts: # includes/filter_header.php # scripts/cron.php # scripts/cron_certificate_refresher.php # scripts/cron_domain_refresher.php # scripts/cron_mail_queue.php # scripts/cron_ticket_email_parser.php
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
chdir(dirname(__FILE__));
|
||||
|
||||
// Ensure we're running from command line
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
if (php_sapi_name() !== 'cli' && $_GET['key'] !== 'GxKo679Jm5xjOtQ81Zo3ywWMVcNB5wgP') {
|
||||
die("This script must be run from the command line.\n");
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ if (mysqli_num_rows($sql_queue) > 0) {
|
||||
$email_content = $rowq['email_content'];
|
||||
$email_ics_str = $rowq['email_cal_str'];
|
||||
|
||||
// Check sender
|
||||
if (!filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
|
||||
$email_from_logging = sanitizeInput($rowq['email_from']);
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 99 WHERE email_id = $email_id");
|
||||
@@ -225,10 +226,14 @@ if (mysqli_num_rows($sql_queue) > 0) {
|
||||
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 1 WHERE email_id = $email_id");
|
||||
|
||||
if (!filter_var($email_recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
// Check recipient
|
||||
$domain = sanitizeInput(substr($email_recipient, strpos($email_recipient, '@') + 1));
|
||||
if (!filter_var($email_recipient, FILTER_VALIDATE_EMAIL) || !checkdnsrr($domain, 'MX')) {
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 99 WHERE email_id = $email_id");
|
||||
$email_to_logging = sanitizeInput($email_recipient);
|
||||
$email_subject_logging = sanitizeInput($rowq['email_subject']);
|
||||
logApp("Cron-Mail-Queue", "Error", "Failed to send email: $email_id due to invalid recipient address. Email subject was: $email_subject_logging");
|
||||
logApp("Cron-Mail-Queue", "Error", "Failed to send email: $email_id to $email_to_logging due to invalid recipient address. Email subject was: $email_subject_logging");
|
||||
appNotify("Mail", "Failed to send email #$email_id to $email_to_logging due to invalid recipient address: Email subject was: $email_subject_logging");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -273,7 +278,7 @@ if (mysqli_num_rows($sql_queue) > 0) {
|
||||
/** =======================================================================
|
||||
* RETRIES: status = 2 (Failed), attempts < 4, wait 30 min
|
||||
* NOTE: Backoff is `email_failed_at <= NOW() - INTERVAL 30 MINUTE`
|
||||
* ======================================================================= */
|
||||
* =======================================================================*/
|
||||
$sql_failed_queue = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM email_queue
|
||||
|
||||
Reference in New Issue
Block a user