Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup mail on development with Ruby on Rails?

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?

like image 672
GiH Avatar asked Nov 20 '11 20:11

GiH


People also ask

How do I use SMTP in Ruby on Rails?

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.

What is ActionMailer?

Action Mailer allows you to send emails from your application using mailer classes and views.

How do you preview emails in Rails?

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.


1 Answers

You can use letter_opener gem by Ryan Bates

like image 76
Andrey Kryachkov Avatar answered Nov 15 '22 06:11

Andrey Kryachkov