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