from: '[email protected]' def welcome_email(user) @user = user @url = 'http://example.com/login' mail(to: @user.email, subject: 'Welcome to My Awesome Site') end end A cross between a Model and a Controller
%> =============================================== You have successfully signed up to example.com, your username is: <%= @user.login %>. To login to the site, just follow this link: <%= @url %>. Thanks for joining and have a great day! app/views/user_mailer/welcome_email.text.erb A view that is rendered over SMTP
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, your username is: <%= @user.login %>.<br/> </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> app/views/user_mailer/welcome_email.html.erb
Mailer can be a rather complex endeavor. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that.” - guides.rubyonrails.org/action_mailer_basics.html
Mailer can be a rather complex endeavor. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that.” - guides.rubyonrails.org/action_mailer_basics.html
• Service Integration • Compostability, Encapsulation, Polymorphism, all good things! • http://localhost:3000/incoming_email • a Controller with an action to handle POST