Last active
May 23, 2022 21:05
-
-
Save RoseAndres/aacf2035d9bccdae2daac4a370bc8688 to your computer and use it in GitHub Desktop.
Easy TestMailer for verifying SMTP settings via rails console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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