diff --git a/config/settings.yml b/config/settings.yml index 05990af2e..6f4368343 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -19,7 +19,7 @@ mail-from: name: "_env:MAILFROM_NAME:Uni2work" email: "_env:MAILFROM_EMAIL:uniworx@localhost" mail-object-domain: "_env:MAILOBJECT_DOMAIN:localhost" -mail-sender-fixed: "_env:MAILSENDER_FIXED:True" +mail-use-replyto-instead-sender: "_env:MAIL_USES_REPLYTO:true" #mail-verp: # separator: "_env:VERP_SEPARATOR:+" # prefix: "_env:VERP_PREFIX:bounce" diff --git a/src/Foundation/Instances.hs b/src/Foundation/Instances.hs index 67e1b501b..1bb5da169 100644 --- a/src/Foundation/Instances.hs +++ b/src/Foundation/Instances.hs @@ -177,7 +177,7 @@ instance YesodMail UniWorX where defaultFromAddress = getsYesod $ view _appMailFrom envelopeFromAddress = getsYesod $ view _appMailEnvelopeFrom mailObjectIdDomain = getsYesod $ view _appMailObjectDomain - fixedSenderInDomain = getsYesod $ view _appMailFixedDomainSender + useReplyToInstead = getsYesod $ view _appMailUseReplyToInstead mailDateTZ = return appTZ mailSmtp act = do pool <- maybe (throwM MailNotAvailable) return =<< getsYesod appSmtpPool diff --git a/src/Mail.hs b/src/Mail.hs index 6a53571e2..97c516308 100644 --- a/src/Mail.hs +++ b/src/Mail.hs @@ -257,8 +257,8 @@ class Yesod site => YesodMail site where mailObjectIdDomain = pack <$> liftIO getHostName -- | Use replyTo instead for all senders within mailObjectIdDomain - fixedSenderInDomain :: (MonadHandler m, HandlerSite m ~ site) => m Bool - fixedSenderInDomain = return False + useReplyToInstead :: (MonadHandler m, HandlerSite m ~ site) => m Bool + useReplyToInstead = return True -- not changeing the sender is the save choice mailDateTZ :: (MonadHandler m, HandlerSite m ~ site) => m TZ mailDateTZ = return utcTZ @@ -316,7 +316,7 @@ defMailT ls (MailT mailC) = do (ret, mail, smtpData) <- runRWST mailC ls (emptyMail fromAddress) mail' <- maybeT (return mail) $ do - guardM fixedSenderInDomain -- if sender must be fixed within ObjectIdDomain, use replyTo instead + guardM useReplyToInstead -- if sender must be fixed within ObjectIdDomain, use replyTo instead let sender = mail ^. _mailFrom domain <- lift mailObjectIdDomain guard $ domain `Text.isSuffixOf` (sender ^. _addressEmail) -- allowing foreign senders might be Fraport specific; maybe remove this guard diff --git a/src/Settings.hs b/src/Settings.hs index 67676bb55..84d910a5a 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -126,7 +126,7 @@ data AppSettings = AppSettings , appMailFrom , appMailSender , appMailSupport :: Address - , appMailFixedDomainSender :: Bool + , appMailUseReplyToInstead :: Bool , appJobWorkers :: Natural , appJobFlushInterval :: Maybe NominalDiffTime , appJobCronInterval :: Maybe NominalDiffTime @@ -558,7 +558,7 @@ instance FromJSON AppSettings where appMailEnvelopeFrom <- o .:? "mail-envelope-from" .!= addressEmail appMailFrom appMailSender <- o .:? "mail-sender" .!= appMailFrom appMailObjectDomain <- o .: "mail-object-domain" - appMailFixedDomainSender <- o .: "mail-sender-fixed" .!= True + appMailUseReplyToInstead <- o .: "mail-use-replyto-instead-sender" .!= True appMailVerp <- fromMaybe VerpNone . join <$> (o .:? "mail-verp" <|> pure Nothing) appMailRetainSent <- o .: "mail-retain-sent"