Commit b18a39a852b424b5d63a9014e1fec29dc2226728

Authored by Rodrigo Souto
1 parent db39710f

Mailer domain

Mailer uses supplier and environment domains to avoid messages being
filtered as spams.
plugins/shopping_cart/lib/shopping_cart_plugin/mailer.rb
... ... @@ -5,8 +5,10 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base
5 5 prepend_view_path(ShoppingCartPlugin.root_path+'/views')
6 6  
7 7 def customer_notification(customer, supplier, items)
  8 + domain = supplier.domains.first || supplier.environment.domains.first
8 9 recipients customer[:email]
9   - from supplier.contact_email
  10 + from 'no-reply@' + domain.name
  11 + reply_to supplier.contact_email
10 12 subject _("[%s] Your buy request was performed successfully.") % supplier[:name]
11 13 content_type 'text/html'
12 14 body :customer => customer,
... ... @@ -16,10 +18,12 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base
16 18 end
17 19  
18 20 def supplier_notification(customer, supplier, items)
19   - recipients supplier.contact_email
20   - from customer[:email]
21   - subject _("[%s] You have a new buy request from %s.") % [supplier.environment.name, customer[:name]]
22   - content_type 'text/html'
  21 + domain = supplier.environment.domains.first
  22 + recipients supplier.contact_email
  23 + from 'no-reply@' + domain.name
  24 + reply_to customer[:email]
  25 + subject _("[%s] You have a new buy request from %s.") % [supplier.environment.name, customer[:name]]
  26 + content_type 'text/html'
23 27 body :customer => customer,
24 28 :supplier => supplier,
25 29 :items => items,
... ...