I use playframework 2.3.x and have Russian and English languages. The problem is that the email sometimes can get the values from the language files.
For example, in the file, i have mail.subject=welcome to our platform. it sometimes just sent the "mail.subject" instead of "welcome to our platform". Please advise how to solve this problem?
def sendEmail(to: String) {
try {
var fromAddress = current.configuration.getString("smtp.from").get
val bcc = current.configuration.getString("smtp.bcc").get
val email = Email(
Messages.get(getLan(), "mail.subject"),
fromAddress,
Seq(to),
bodyHtml = Some(views.html.custom.mails.application().toString()),
bcc = Seq(bcc)
)
MailerPlugin.send(email)
} catch {
case ex: Exception => PlayLogger.instance.error(ex.getMessage)
}
}
mail.subjectkey is not defined for some language that you use, and that language is set in the request cookie.Play, by default, take language from the cookie. The default language is selected if no language in a cookie was found or that language is not acceptable.
You can fix it by set the language explicitly or create your own language detection.