I bought a Rails store (i am slowly learning), and when someone places an order, I know they get an email because of the following code in the order_mailer.rb file:
class OrderMailer < ActionMailer::Base
default from: 'xxxxx@xxxxxxxxx.com'
def receipt(order)
@order = order
mail(to: order.user.email, subject: 'Your Order with Flagstuff.com')
end
end
Is there an easy way to add myself as a CC to this email so I know when an order comes through?
From what I can gather, given my very limited knowledge of Rails, the orders_controllers.rb calls the order_mailer.rb when someone places an order. If I could locate that code and insert another .rb file (admin_email.rb) that looks almost identical, but with my email address instead of order.user.email, I think that might work.
I am looking for an easy answer and a learning experience =)
As an addition the answer from David, you can also add yourself as bcc if you change the defaults line to this:
check out the docs for more examples: http://api.rubyonrails.org/classes/ActionMailer/Base.html
Also, this railscast might be interesting: http://railscasts.com/episodes/206-action-mailer-in-rails-3