Add button for sending test email

This allows for easily testing whether the provided email configuration is correct.

PR #20488.
This commit is contained in:
Thomas Piccirello 2023-12-26 10:54:26 -08:00 committed by Chocobo1
parent 1702b6c891
commit c06817f4eb
9 changed files with 67 additions and 1 deletions

View file

@ -680,6 +680,24 @@ void Application::sendNotificationEmail(const BitTorrent::Torrent *torrent)
content);
}
void Application::sendTestEmail() const
{
const Preferences *pref = Preferences::instance();
if (pref->isMailNotificationEnabled())
{
// Prepare mail content
const QString content = tr("This is a test email.") + u'\n'
+ tr("Thank you for using qBittorrent.") + u'\n';
// Send the notification email
auto *smtp = new Net::Smtp();
smtp->sendMail(pref->getMailNotificationSender(),
pref->getMailNotificationEmail(),
tr("Test email"),
content);
}
}
void Application::torrentAdded(const BitTorrent::Torrent *torrent) const
{
const Preferences *pref = Preferences::instance();