Set webhook email sender identity

This commit is contained in:
Andy Dixon
2026-09-11 18:10:16 +01:00
parent 3d88ae2132
commit f3f58dbf95
2 changed files with 61 additions and 6 deletions
+7 -6
View File
@@ -319,12 +319,13 @@ HTML;
$emailHeaders = "MIME-Version: 1.0\r\n";
// Content-type specifies HTML email with UTF-8 character encoding
$emailHeaders .= "Content-type: text/html; charset=UTF-8\r\n";
// From header sets the sender address to a no-reply address at wh.dixon.cx
$emailHeaders .= "From: no-reply@wh.dixon.cx\r\n";
// Send the email using PHP's built-in mail function
// Parameters: recipient, subject, message body, headers
$mailSent = mail($email, $subject, $html, $emailHeaders);
// Keep both the visible sender and SMTP envelope sender on the public domain.
$envelopeSender = 'no-reply@dixon.cx';
$emailHeaders .= "From: Webhook Call <$envelopeSender>\r\n";
// Send the email using PHP's built-in mail function
// The -f option prevents sendmail from deriving www-data@<container-hostname>.
$mailSent = mail($email, $subject, $html, $emailHeaders, '-f' . $envelopeSender);
// Check if the email was sent successfully
if (!$mailSent) {