Skip to content

Commit

Permalink
feat: added no reply sender mail address, closes #2992
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Jun 14, 2024
1 parent 862cd36 commit 078646d
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions phpmyfaq/src/phpMyFAQ/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ public function getAdminEmail(): string
return $this->config['main.administrationMail'];
}

/**
* Returns the email address of the no-reply sender
*/
public function getNoReplyEmail(): string
{
if (empty($this->config['mail.noReplySenderAddress'])) {
return $this->getAdminEmail();
}

return $this->config['mail.noReplySenderAddress'];
}

/**
* Returns the default URL of the phpMyFAQ installation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function sendTestMail(Request $request): JsonResponse

try {
$mail = new Mail($configuration);
$mail->setReplyTo($configuration->getAdminEmail());
$mail->addTo($configuration->getAdminEmail());
$mail->setReplyTo($configuration->getNoReplyEmail());
$mail->subject = $configuration->getTitle() . ': Mail test successful.';
$mail->message = 'It works on my machine. 🚀';
$result = $mail->send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function create(Request $request): JsonResponse
try {
$mailer->setReplyTo($email, $author);
$mailer->addTo($this->configuration->getAdminEmail());
$mailer->setReplyTo($this->configuration->getNoReplyEmail());
$mailer->subject = Utils::resolveMarkers('Feedback: %sitename%', $this->configuration);
$mailer->message = $question;
$mailer->send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public function requestUserRemoval(Request $request): JsonResponse
try {
$mailer->setReplyTo($email, $author);
$mailer->addTo($this->configuration->getAdminEmail());
$mailer->setReplyTo($this->configuration->getNoReplyEmail());
$mailer->subject = $this->configuration->getTitle() . ': Remove User Request';
$mailer->message = $question;
$mailer->send();
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(private Configuration $configuration)
$this->faq = new Faq($this->configuration);
$this->category = new Category($this->configuration);
$this->mail->setReplyTo(
$this->configuration->getAdminEmail(),
$this->configuration->getNoReplyEmail(),
$this->configuration->getTitle()
);
}
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/translations/language_de.php
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,6 @@
$PMF_LANG['msgFormDisabledDueToMissingCategories'] = 'Du kannst nichts einreichen, weil keine Kategorien eingerichtet sind. Wende dich bitte an den <a class="alert-link" href="contact.html">Administrator</a>.';

// added v4.0.0-alpha.3 - 2024-06-14 by Thorsten
$LANG_CONF['mail.noReplySenderAddress'] = ['input', 'Absende-Adresse für E-Mails'];
$LANG_CONF['mail.noReplySenderAddress'] = ['input', 'No-Reply-Adresse für E-Mails'];

return $PMF_LANG;
2 changes: 1 addition & 1 deletion phpmyfaq/translations/language_en.php
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,6 @@
$PMF_LANG['msgFormDisabledDueToMissingCategories'] = 'You cant use this form due to missing configured categories. Please inform the <a class="alert-link" href="contact.html">administrator</a>.';

// added v4.0.0-alpha.3 - 2024-06-14 by Thorsten
$LANG_CONF['mail.noReplySenderAddress'] = ['input', 'Sending address for emails'];
$LANG_CONF['mail.noReplySenderAddress'] = ['input', 'No reply address for emails'];

return $PMF_LANG;

0 comments on commit 078646d

Please sign in to comment.