foodsoft/plugins/messages/app/mailers/messages_mailer.rb

20 lines
744 B
Ruby
Raw Normal View History

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
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}>"
else
reply_to = "#{show_user(message.sender)} <#{message.sender.email}>"
end
mail subject: message.subject,
2014-03-07 09:51:24 +01:00
to: recipient.email,
2016-03-07 22:17:18 +01:00
from: "#{show_user(message.sender)} via #{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig[:email_sender]}>",
reply_to: reply_to
2014-03-07 09:51:24 +01:00
end
end