Browse Source

Improve sender field in mail notifications

Problem statement: user sees its email address in email notification,
while it is better to have sender field app-personalized, like it did
in Nextcloud: they send notifications from user's email address and
add alias 'Nextcloud' to it.

This patch adds alias 'qBittorrent' to qBittorrent email notifications,
so user sees more user-friendly email notification.

PR #17374.
adaptive-webui-19844
Dmitry Vodopyanov 2 years ago committed by GitHub
parent
commit
f20f479a4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp
  2. 2
      src/base/net/smtp.cpp

2
src/app/application.cpp

@ -476,7 +476,7 @@ void Application::sendNotificationEmail(const BitTorrent::Torrent *torrent)
auto *smtp = new Net::Smtp(this); auto *smtp = new Net::Smtp(this);
smtp->sendMail(pref->getMailNotificationSender(), smtp->sendMail(pref->getMailNotificationSender(),
pref->getMailNotificationEmail(), pref->getMailNotificationEmail(),
tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()), tr("Torrent \"%1\" has finished downloading").arg(torrent->name()),
content); content);
} }

2
src/base/net/smtp.cpp

@ -138,7 +138,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
{ {
const Preferences *const pref = Preferences::instance(); const Preferences *const pref = Preferences::instance();
m_message = "Date: " + getCurrentDateTime().toLatin1() + "\r\n" m_message = "Date: " + getCurrentDateTime().toLatin1() + "\r\n"
+ encodeMimeHeader(u"From"_qs, from) + encodeMimeHeader(u"From"_qs, u"qBittorrent <%1>"_qs.arg(from))
+ encodeMimeHeader(u"Subject"_qs, subject) + encodeMimeHeader(u"Subject"_qs, subject)
+ encodeMimeHeader(u"To"_qs, to) + encodeMimeHeader(u"To"_qs, to)
+ "MIME-Version: 1.0\r\n" + "MIME-Version: 1.0\r\n"

Loading…
Cancel
Save