From 64d88eacd635eb3cd1711cf7a0c769b19cd1095b Mon Sep 17 00:00:00 2001 From: micio Date: Wed, 2 Jan 2019 20:12:46 +0000 Subject: [PATCH] Bazaar/ProtectServer : fixed From fiels for outgoing mails git-svn-id: svn://ultimatepp.org/upp/trunk@12641 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/ProtectServer/ProtectServer.cpp | 4 ++-- bazaar/ProtectServer/ProtectServer.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bazaar/ProtectServer/ProtectServer.cpp b/bazaar/ProtectServer/ProtectServer.cpp index 529d9bdef..96b7f98bf 100644 --- a/bazaar/ProtectServer/ProtectServer.cpp +++ b/bazaar/ProtectServer/ProtectServer.cpp @@ -211,7 +211,7 @@ bool ProtectServer::SendMACAlert(String const &eMail, Vector const &mail smtp.TimeSent(GetSysTime()); smtp.To(alertMACEMail); smtp.Subject(t_("PROTECT SERVER : ATTEMPT TO REGISTER WITH EXPIRED MAC")); -// smtp.From(serverVars.Get("SERVER_NAME")); + smtp.From(fromMail, fromName); String body = "Attempt to register with e-mail : " + eMail + "\n"; body += "E-Mails connected to this one by MAC addresses :\n"; for(int i = 0; i < mails.GetCount(); i++) @@ -774,7 +774,7 @@ bool ProtectServer::SendActivationMail(VectorMap const &userData, smtp.TimeSent(GetSysTime()); smtp.To(userData.Get("EMAIL")); smtp.Subject(subject); -// smtp.From(serverVars.Get("SERVER_NAME")); + smtp.From(fromMail, fromName); smtp.Body(body, mime); return smtp.Send(); } diff --git a/bazaar/ProtectServer/ProtectServer.h b/bazaar/ProtectServer/ProtectServer.h index 37d616450..0a2db3aec 100644 --- a/bazaar/ProtectServer/ProtectServer.h +++ b/bazaar/ProtectServer/ProtectServer.h @@ -56,6 +56,11 @@ class ProtectServer : public Scgi // key used to en/decrypt http data String communicationKey; + // smtp resets the From field on each New() + // so we shall store it here :-( + String fromMail; + String fromName; + // welcome message sent on key activation e-mail // a %ACTIVATIONKEY% string inside body will be // replaced by current activation key @@ -140,6 +145,9 @@ public: // gets mailer Smtp &GetSmtp(void) { return smtp; } + // sets smtp 'From' fields + ProtectServer &From(String const &mail, String const &name = Null) { fromMail = mail; fromName = name; return *this; } + // sets application key (to be returned on auth success) ProtectServer &SetAppKey(String const &k) { appKey = k; return *this; } String GetAppKey(void) { return appKey; }