

smtp_settings ) end end def prevent_delivery_to_guests if &. Mime_type, set the encoding, and create the attachment.Ĭlass InvitationsMailer after_action :set_delivery_options, :prevent_delivery_to_guests, :set_business_headers def feedback_message end def campaign_message end private def set_delivery_options # You have access to the mail instance, # and instance variables here if &. Pass the file name and content and Action Mailer and the Text or multipart - depending on what email templates you have defined.Īction Mailer makes it very easy to add attachments. mail - Creates the actual email itself.For example,Īttachments = File.read('file-name.jpg'). attachments - Allows you to add attachments to your email.

Header field names and value pairs, or you can call headers = headers - Specifies any header on the email you want.There are just three methods that you need to send pretty much any email 2.3 Complete List of Action Mailer Methods Self-encoding text first, please refer to the 2.2 Auto encoding header valuesĪction Mailer handles the auto encoding of multibyte characters inside ofįor more complex examples such as defining alternate character sets or You want to inspect, alter, or do anything else with the Mail::Message object you canĪccess it with the message method on the ActionMailer::MessageDelivery object. TheĪctionMailer::MessageDelivery object is a wrapper around a Mail::Message. The method welcome_email returns an ActionMailer::MessageDelivery object whichĬan then be told to deliver_now or deliver_later to send itself out. deliver_now end end end CopyĪny key-value pair passed to with just becomes the params for the mailerĪction.
