class UserMailer < ApplicationMailer default from: 'Acme <onboarding@resend.dev>' # this domain must be verified with Resend def welcome_email @user = params[:user] @url = 'http://example.com/login' mail(to: ["delivered@resend.dev"], subject: 'hello world') endend
And create your ERB email template.
app/views/user_mailer/welcome_email.html.erb
<!doctype html><html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> </head> <body> <h1>Welcome to example.com, <%= @user.name %></h1> <p>You have successfully signed up to example.com,</p> <p>To login to the site, just follow this link: <%= @url %>.</p> <p>Thanks for joining and have a great day!</p> </body></html>
Initialize your UserMailer class. This should return a UserMailer instance.