Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send an email with rails

This is probably very straight forward and simple, but I'm very new and noob at ruby on rails. I have a simple email php script that I used on an older website, but now since I've converted to rails I'm not sure as to how to create the equivalent to that.

I tried using rails generate mailer Notifier and then inside of that added a welcome method which sent and email. However in the User controller (under create so that when a user made an account their email address was sent a welcome email) i just got an error that said Notifier wasn't declared.

In the user controller I had

if @user.save
  Notifier.welcome(@user).deliver
end

this did not work

like image 342
Vasseurth Avatar asked Dec 22 '22 11:12

Vasseurth


1 Answers

I suggest reading Action Mailer Guide

like image 72
gertas Avatar answered Dec 24 '22 00:12

gertas