Commit b18a39a852b424b5d63a9014e1fec29dc2226728
1 parent
db39710f
Exists in
master
and in
23 other branches
Mailer domain
Mailer uses supplier and environment domains to avoid messages being filtered as spams.
Showing
1 changed file
with
9 additions
and
5 deletions
Show diff stats
plugins/shopping_cart/lib/shopping_cart_plugin/mailer.rb
| @@ -5,8 +5,10 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base | @@ -5,8 +5,10 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base | ||
| 5 | prepend_view_path(ShoppingCartPlugin.root_path+'/views') | 5 | prepend_view_path(ShoppingCartPlugin.root_path+'/views') |
| 6 | 6 | ||
| 7 | def customer_notification(customer, supplier, items) | 7 | def customer_notification(customer, supplier, items) |
| 8 | + domain = supplier.domains.first || supplier.environment.domains.first | ||
| 8 | recipients customer[:email] | 9 | recipients customer[:email] |
| 9 | - from supplier.contact_email | 10 | + from 'no-reply@' + domain.name |
| 11 | + reply_to supplier.contact_email | ||
| 10 | subject _("[%s] Your buy request was performed successfully.") % supplier[:name] | 12 | subject _("[%s] Your buy request was performed successfully.") % supplier[:name] |
| 11 | content_type 'text/html' | 13 | content_type 'text/html' |
| 12 | body :customer => customer, | 14 | body :customer => customer, |
| @@ -16,10 +18,12 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base | @@ -16,10 +18,12 @@ class ShoppingCartPlugin::Mailer < ActionMailer::Base | ||
| 16 | end | 18 | end |
| 17 | 19 | ||
| 18 | def supplier_notification(customer, supplier, items) | 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 | body :customer => customer, | 27 | body :customer => customer, |
| 24 | :supplier => supplier, | 28 | :supplier => supplier, |
| 25 | :items => items, | 29 | :items => items, |