You have successfully signed up to example.com, and your username is: <%= @user.login %>.
To login to the site, just follow this link: <%=h @url %>.
Thanks for joining and have a great day!
html content, can also be the name of an action that you call
" part "text/plain" do |p| p.body = "text content, can also be the name of an action that you call" end end end
h4. Sending Emails with Attachments Attachments can be added by using the +attachment+ method. The +attachment+ method has two variations, you can either pass the body in as an option, or create it within a block. Usually you will use the variation shown below for the "image/jpeg" attachment, here you just pass in the content type and body as a options hash to the attachment method. However, if you need to do some processing to create the attachment, such as with the PDF below, then the block variation can be used. This email uses the "multipart/mixed" content type because each part is a different block of content. This indicates to the email client that it must show all the parts that it can display to the end user. class UserMailer < ActionMailer::Base def welcome_email(user) recipients user.email_address subject "New account information" from "system@example.com" content_type "multipart/mixed" attachment :content_type => "image/jpeg", :body => File.read("an-image.jpg") attachment "application/pdf" do |a| pdf = generate_your_pdf_here(:name => user) a.body = pdf end end end h4. Sending Multipart Emails with Attachments Once you use the +attachment+ method, ActionMailer will no longer automagically use the correct template based on the filename. You must declare which template you are using for each content type via the +part+ method. Here we are making the email "multipart/mixed" with three top level parts, a "multipart/alternative", an "image/jpeg" and an "application/pdf". Within the "multipart/alternative" we are nesting a "text/html" and "text/plain" version of the same message. This tells the email client that each of the top level parts should be shown to the end user, however, the first part has the content type "multipart/alternative" and provides two versions of the same message, a plain text and HTML version. In the following example, there would be two template files, +welcome_email.text.html.erb+ and +welcome_email.text.plain.erb+ in the +app/views/user_mailer+ folder. class UserMailer < ActionMailer::Base def welcome_email(user) recipients user.email_address subject "New account information" from "system@example.com" content_type "multipart/mixed" part "multipart/alternative" do |alternative| alternative.part "text/html" do |html| html.body = render_message("welcome_email.text.html", :message => "