Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gmrdad82/920ad5cdf459ad79633aca865aa61ad8 to your computer and use it in GitHub Desktop.
Save gmrdad82/920ad5cdf459ad79633aca865aa61ad8 to your computer and use it in GitHub Desktop.
Rails Console Actionmailer test
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
@recipients = "[email protected]"
@from = "[email protected]"
@subject = "test from the Rails Console"
@body = "This is a test email"
end
end
MyMailer::deliver_test_email
# if all goes well you should see a lot text scrolling by
# Copied with love from http://lists.radiantcms.org/pipermail/radiant/2007-February/003394.html
# btw for info on how to get rails working with Gmail SMTP go to http://robertbousquet.com/articles/using-gmail-smtp-with-actionmailer
@gmrdad82
Copy link
Author

gmrdad82 commented Jan 19, 2017

class TestMailer < ActionMailer::Base

  default :from => "[email protected]"

  def welcome_email
    mail(:to => "[email protected]", :subject => "Test mail", :body => "Test mail body")
  end
end

TestMailer.welcome_email.deliver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment