When you deploy an app into production, you usually have to configure the application for the mail server you plan to use and how the application authenticates. The following code is an exemplary for connecting to a mail server.
config.action_mailer.smtp_settings = {
:address => "mail.anynines.com",
:port => 587,
:user_name => ENV['EMAIL_USERNAME'],
:password => ENV['EMAIL_PASSWORD'],
:authentication => "plain",
:enable_starttls_auto => true }
Usually, in a developer's workflow, you do not often send ‘real’ mails in development and test, but only in production. So, usually, this configuration will reside in the config/environments/production.rb. You can find all of the available options here. As you can see, we load some data from the Environment, namely username and password. You should not hardcode such things in your code, since they should not be in the version control system. For more information about reading sensitive data from your application's environment, you can consult this article.
Comments
0 comments
Please sign in to leave a comment.