Is there any way to send emails in rails 3 to a local file or so, instead of using an SMTP server? I'd like to test the email's contents without using any kind of SMTP, ideally only in DEV environment.
The best would be a local SMTP or something that allowed me to inspect emails, check email addresses, etc.
Go to the config folder of your emails project and open environment. rb file and add the following line at the bottom of this file. It tells ActionMailer that you want to use the SMTP server. You can also set it to be :sendmail if you are using a Unix-based operating system such as Mac OS X or Linux.
Action Mailer allows you to send emails from your application using mailer classes and views.
The default_url_options setting is useful for constructing link URLs in email templates. Usually, the :host , i.e. the fully qualified name of the web server, is needed to be set up with this config option. It has nothing to do with sending emails, it only configures displaying links in the emails.
You can use the :test system delivery
ActionMailer::Base.delivery_method = :test
There are also a :file delivery_method
ActionMailer::Base.delivery_method = :file
You can define where put all email with file_settings
ActionMailer::Base.file_settings = { :location => Rails.root.join('tmp/mail') }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With