Rails, dynamic emails sent do different email address on staging server
So for static email in the system, I have a staging environment config setup which works well.
With dynamic emails, I have this code in my mailer.rb file.
if RAILS_ENV == 'staging'
recipients STAGING_TEST_EMAIL
else
recipients request[:email]
end
This works, I just wanted to know if there was a tidier or better way to do this or if 开发者_StackOverflow社区this is OK in terms of best practice.
One option, is to modify the staging servers mailing gem..
IE...
def email.press_send
recipients STAGING_TEST_EMAIL
end
My personal favorite...
is to talk to the sys admin and arrange for email sent from the staging, test, box directly into a file, so then you can view it.
ie, all email sent out is sent to this user "test_email", who has this .forward "| cat >> /tmp/new_mail.txt"
精彩评论