I downloaded a project from github that has a mailer when deployed to production, but on my own local copy the mailer doesn't work. How do I setup mail locally for development so that I can test it?
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.
rails generates a mail preview if you use rails g mailer CustomMailer . You will get a file CustomMailerPreview inside spec/mailers/previews folder. Here you can write your method that will call the mailer and it'll generate a preview.
You can use letter_opener gem by Ryan Bates
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