2014-03-07 09:51:24 +01:00
|
|
|
class MessagesMailer < Mailer
|
|
|
|
# Sends an email copy of the given internal foodsoft message.
|
|
|
|
def foodsoft_message(message, recipient)
|
|
|
|
@message = message
|
|
|
|
|
2016-02-26 14:42:16 +01:00
|
|
|
reply_email_domain = FoodsoftConfig[:reply_email_domain]
|
|
|
|
if reply_email_domain
|
|
|
|
hash = message.mail_hash_for_user recipient
|
2016-03-07 22:17:18 +01:00
|
|
|
reply_to = "#{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig.scope}.#{message.id}.#{recipient.id}.#{hash}@#{reply_email_domain}>"
|
2016-02-26 14:42:16 +01:00
|
|
|
end
|
|
|
|
|
2017-08-18 00:11:36 +02:00
|
|
|
mail subject: message.subject,
|
2017-08-18 00:21:52 +02:00
|
|
|
to: recipient,
|
2017-08-18 00:25:17 +02:00
|
|
|
from: message.sender,
|
2016-02-26 14:42:16 +01:00
|
|
|
reply_to: reply_to
|
2014-03-07 09:51:24 +01:00
|
|
|
end
|
|
|
|
end
|