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)
|
|
|
|
set_foodcoop_scope
|
|
|
|
@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
|
|
|
|
reply_to = "Foodsoft <#{FoodsoftConfig.scope}.#{message.id}.#{recipient.id}.#{hash}@#{reply_email_domain}>"
|
|
|
|
else
|
|
|
|
reply_to = "#{show_user(message.sender)} <#{message.sender.email}>"
|
|
|
|
end
|
|
|
|
|
2014-03-07 09:51:24 +01:00
|
|
|
mail subject: "[#{FoodsoftConfig[:name]}] " + message.subject,
|
|
|
|
to: recipient.email,
|
2015-02-18 12:44:50 +01:00
|
|
|
from: "#{show_user(message.sender)} via Foodsoft <#{FoodsoftConfig[:email_sender]}>",
|
2016-02-26 14:42:16 +01:00
|
|
|
reply_to: reply_to
|
2014-03-07 09:51:24 +01:00
|
|
|
end
|
|
|
|
end
|