Skip to content

Commit

Permalink
set sender-address of emails which were sent using an admin/a reselle…
Browse files Browse the repository at this point in the history
…r to the global settings email so sending it using provided smtp settings will not fail antispam checks; fixes #1289

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Dec 3, 2024
1 parent 665b879 commit dcaff3f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/Froxlor/Api/Commands/EmailAccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ public function add()
$_mailerror = false;
$mailerr_msg = "";
try {
$this->mailer()->setFrom($admin['email'], User::getCorrectUserSalutation($admin));
$this->mailer()->setFrom(Settings::Get('panel.adminmail'), User::getCorrectUserSalutation($admin));
$this->mailer()->clearReplyTos();
$this->mailer()->addReplyTo($admin['email'], User::getCorrectUserSalutation($admin));
$this->mailer()->Subject = $mail_subject;
$this->mailer()->AltBody = $mail_body;
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
Expand Down Expand Up @@ -290,7 +292,9 @@ public function add()

$_mailerror = false;
try {
$this->mailer()->setFrom($admin['email'], User::getCorrectUserSalutation($admin));
$this->mailer()->setFrom(Settings::Get('panel.adminmail'), User::getCorrectUserSalutation($admin));
$this->mailer()->clearReplyTos();
$this->mailer()->addReplyTo($admin['email'], User::getCorrectUserSalutation($admin));
$this->mailer()->Subject = $mail_subject;
$this->mailer()->AltBody = $mail_body;
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
Expand Down
8 changes: 6 additions & 2 deletions lib/Froxlor/Cron/Traffic/ReportsCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public static function run()
$_mailerror = false;
$mailerr_msg = "";
try {
$mail->SetFrom($row['adminmail'], $row['adminname']);
$mail->setFrom(Settings::Get('panel.adminmail'), $row['adminname']);
$mail->clearReplyTos();
$mail->addReplyTo($row['adminmail'], $row['adminname']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(nl2br($mail_body));
Expand Down Expand Up @@ -405,7 +407,9 @@ private static function usageDiskspace()
$_mailerror = false;
$mailerr_msg = "";
try {
$mail->SetFrom($row['adminmail'], $row['adminname']);
$mail->setFrom(Settings::Get('panel.adminmail'), $row['adminname']);
$mail->clearReplyTos();
$mail->addReplyTo($row['adminmail'], $row['adminname']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(nl2br($mail_body));
Expand Down
4 changes: 2 additions & 2 deletions lib/Froxlor/System/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public function __construct(bool $exceptions = false)

if (self::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76
$this->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
$this->setFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') {
$this->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
$this->addReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
}
}
}
Expand Down

0 comments on commit dcaff3f

Please sign in to comment.