Skip to content

Instantly share code, notes, and snippets.

@RoseAndres
Last active May 23, 2022 21:05
Show Gist options
  • Save RoseAndres/aacf2035d9bccdae2daac4a370bc8688 to your computer and use it in GitHub Desktop.
Save RoseAndres/aacf2035d9bccdae2daac4a370bc8688 to your computer and use it in GitHub Desktop.
Easy TestMailer for verifying SMTP settings via rails console
# You can either paste all of the code below directly into a rails console session (if you only plan on needing to test
# this once or twice), or put the TestMailer class in a directory that would get autoloaded so that you can use it via
# line 17 at will.
class TestMailer < ApplicationMailer
def send_email
mail(
to: "ex@mple.com",
subject: "test smtp service",
body: "this is a test",
content_type: "text/html",
from: "test@dev.com",
)
end
end
TestMailer.send_email.deliver_now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment