Bazaar/ProtectServer : fixed From fiels for outgoing mails

git-svn-id: svn://ultimatepp.org/upp/trunk@12641 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
micio 2019-01-02 20:12:46 +00:00
parent 31b57fd3ac
commit 64d88eacd6
2 changed files with 10 additions and 2 deletions

View file

@ -211,7 +211,7 @@ bool ProtectServer::SendMACAlert(String const &eMail, Vector<String> 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<String, Value> 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();
}

View file

@ -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; }