Skip to content

Commit

Permalink
Ajoute Reply-To et permet la configuration du From (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
niladic authored Nov 3, 2021
1 parent 0937d1d commit 252682b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/services/NotificationService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ class NotificationService @Inject() (

private val https = configuration.underlying.getString("app.https") === "true"

private val from = s"Administration+ <${Constants.supportEmail}>"
private val from: String = configuration
.getOptional[String]("app.emailsFrom")
.getOrElse(s"Administration+ <${Constants.supportEmail}>")

private val replyTo = List(s"Administration+ <${Constants.supportEmail}>")

private def emailIsBlacklisted(email: Email): Boolean =
notificationEmailBlacklist.exists(black => email.to.exists(_.contains(black)))
Expand Down Expand Up @@ -230,6 +234,7 @@ class NotificationService @Inject() (
val email = Email(
subject = common.magicLinkSubject,
from = from,
replyTo = replyTo,
to = List(
userName
.filter(_.nonEmpty)
Expand All @@ -248,6 +253,7 @@ class NotificationService @Inject() (
val email = Email(
subject = common.mandatSmsSentSubject,
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(user.name)} <${user.email}>"),
bodyHtml = Some(common.renderEmail(bodyInner))
)
Expand All @@ -261,6 +267,7 @@ class NotificationService @Inject() (
val email = Email(
subject = common.mandatSmsClosedSubject,
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(user.name)} <${user.email}>"),
bodyHtml = Some(common.renderEmail(bodyInner))
)
Expand Down Expand Up @@ -289,6 +296,7 @@ class NotificationService @Inject() (
Email(
subject = subject,
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(group.name)} <${group.email.get}>"),
bodyHtml = Some(bodyHtml)
)
Expand All @@ -299,6 +307,7 @@ class NotificationService @Inject() (
Email(
subject = "[A+] Bienvenue sur Administration+",
from = from,
replyTo = replyTo,
to = List(
userName
.filter(_.nonEmpty)
Expand All @@ -318,6 +327,7 @@ class NotificationService @Inject() (
Email(
subject = s"[A+] Nouvelle demande d'aide : ${application.subject}",
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(invitedUser.name)} <${invitedUser.email}>"),
bodyHtml = Some(common.renderEmail(bodyInner))
)
Expand All @@ -330,6 +340,7 @@ class NotificationService @Inject() (
Email(
subject = s"[A+] Nouvelle réponse pour : ${application.subject}",
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(user.name)} <${user.email}>"),
bodyHtml = Some(common.renderEmail(bodyInner))
)
Expand Down Expand Up @@ -370,6 +381,7 @@ class NotificationService @Inject() (
val email = Email(
subject = common.weeklyEmailSubject,
from = from,
replyTo = replyTo,
to = List(s"${quoteEmailPhrase(infos.user.name)} <${infos.user.email}>"),
bodyHtml = Some(common.renderEmail(bodyInner))
)
Expand Down
1 change: 1 addition & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ app.groupsWhichCannotHaveInstructors = ""
app.groupsWhichCannotHaveInstructors = ${?GROUPS_WHICH_CANNOT_HAVE_INSTRUCTORS}
app.topHeaderWarningMessage = ${?TOP_HEADER_WARNING_MESSAGE}
app.personalDataRetentionInMonths = ${?PERSONAL_DATA_RETENTION_IN_MONTHS}
app.emailsFrom = ${?EMAILS_FROM}


### Sentry
Expand Down

0 comments on commit 252682b

Please sign in to comment.