Sha256: bbaa09f2926bd68ab56cbe8c8604b71a1131e51f294d142b14e3b319b2757b77
Contents?: true
Size: 868 Bytes
Versions: 13
Compression:
Stored size: 868 Bytes
Contents
= Mailers The mailer class, is not that different than what default Rails has to offer. Mail classes are located in the `app/mailers/decidim/<my_module>` directory, and named: `<my_custom>_mailer.rb`. ```ruby # frozen_string_literal: true # app/mailers/decidim/my_module/my_custom_mailer.rb module Decidim module MyModule class MyCustomMailer < Decidim::ApplicationMailer def greeting(user) with_user(user) do @user = user subject = I18n.t("greeting.subject", scope: "decidim.my_module.mailer.my_custom_mailer") mail(to: user.email, subject:) end end end end end ``` Please notice the `with_user` method, that is being used to set the locale of the mailer to the user's locale. == More information - https://edgeguides.rubyonrails.org/action_mailer_basics.html[Action Mailer documentation]
Version data entries
13 entries across 13 versions & 1 rubygems