actionmailer

How to use a different layout in Actionmailer messages?

这一生的挚爱 提交于 2020-04-10 09:30:14
问题 I have project_mailer with layout but I want to use different method if the project_notification method has parameter that unsubscribe_link = true . layout "project_mail" def project_notification(user, projects, unsubsribe_link = false) attachments.inline['logo_252.png'] = File.read(Rails.root + 'public/images/logo_252.png') @user = user @projects = projects mail(:to => user.email, :subject => "New Projects") end 回答1: I asume you already solved your question, I answer to help others: layout

How to use a different layout in Actionmailer messages?

左心房为你撑大大i 提交于 2020-04-10 09:30:03
问题 I have project_mailer with layout but I want to use different method if the project_notification method has parameter that unsubscribe_link = true . layout "project_mail" def project_notification(user, projects, unsubsribe_link = false) attachments.inline['logo_252.png'] = File.read(Rails.root + 'public/images/logo_252.png') @user = user @projects = projects mail(:to => user.email, :subject => "New Projects") end 回答1: I asume you already solved your question, I answer to help others: layout

ActionMailer non-ASCII characters

柔情痞子 提交于 2020-02-04 11:51:24
问题 I'm trying to send text/plain emails with ActionMailer that have non-ASCII characters in them. However, an email with the contents: “This has smart quotes” Displays in emails (and the logs) as: =E2=80=9CThis has smart quotes=E2=80=9D And the Content-Transfer-Encoding of the email is quoted-printable . In the view, this text is rendered like so: <%= raw(strip_tags(@message)) %> I'm not sure where this is happening, the charset header of the email is UTF-8. This is Ruby 1.9.3-p194 and Rails 3.2

Cloud9 and ActionMailer / Mailgun?

久未见 提交于 2020-01-25 03:43:07
问题 I hope you can lend me a hand with this! I used to develop locally, but I'm abroad and I'm using Cloud9 to work with some projects. Currently, It's giving me a hard time with Action Mailer. My ActionMailer Initializer: ActionMailer::Base.smtp_settings = { port: '2525', address: 'smtp.mailgun.org', user_name: ENV['MAILGUN_SMTP_LOGIN'], password: ENV['MAILGUN_SMTP_PASSWORD'], domain: 'app07ad98bdda3b4c469a24228512cffe5c.mailgun.org', authentication: :plain, content_type: 'text/html' }

utf-8 and ActionMailer

时光毁灭记忆、已成空白 提交于 2020-01-24 10:16:48
问题 I'm facing some problems with UTF-8 and ActionMailer. My application has a form (contact) that when it is submitted, it sends an email to me. The problem is that when somebody enters some chars like öäüß, I receive the message encoded like for example =?UTF-8?Q?funktioniert_oder_nicht.=0D=0A=0D=0Ameine_Stra=C3=9Fe_ist_die?= =?UTF-8?Q?_Bratwurststra=C3=9Fe=0D=0A=0D=0A=C3=B6=C3=A4?= As I understand, ActionMailer per default is utf-8 ready. Analyzing the log from my server, when the form is

Set the Message-ID mail header in Rails3 / ActionMailer

佐手、 提交于 2020-01-20 21:45:30
问题 I would like to alter the Message-ID header that is in the header portion of an email sent from a Ruby on Rails v3 application using ActionMailer. I am using Sendmail on localhost for mail delivery. Do I configure this in Sendmail or ActionMailer? Where do I configure this (if it is ActionMailer): a file in config/ folder or a file in app/mailers/ folder? 回答1: Teddy's answer is good, except that if you actually want each message to have a different ID, you need to make the default a lambda.

Rails - Storing a ActionMail Mail.new object in the database

霸气de小男生 提交于 2020-01-17 04:10:07
问题 I'm creating a mail object like so: textpart_to_inject= params[:text] htmlpart_to_inject= params[:html] message_all = Mail.new do to #{params[:to]} from #{params[:from]} subject #{params[:subject]} text_part do body textpart_to_inject end html_part do content_type 'text/html; charset=UTF-8' body htmlpart_to_inject end end I then want to insert that into the database like so: @incoming_mail = IncomingMail.create(:message_all => Base64.encode64(message_all), :message_plain => Base64.encode64

Rails 3: Sending Mail with Attachment - corrupted file after first send

限于喜欢 提交于 2020-01-16 02:15:20
问题 I want to implement a real simpel newsletter. Therefor I can select as much recipients I want. To that newsletter I can attach a file. This works great for the first mail. All next mails have corrupted attachments (1 byte size). actionmailer: def send_newsletter(recipient,subject,content,file) @content = content if file attachments[file.original_filename] = { :content=> file.read, :mime_type=> file.content_type } end mail(:to => recipient, :template_name => "deliver_newsletter", :subject =>

Rails 3: Sending Mail with Attachment - corrupted file after first send

霸气de小男生 提交于 2020-01-16 02:15:10
问题 I want to implement a real simpel newsletter. Therefor I can select as much recipients I want. To that newsletter I can attach a file. This works great for the first mail. All next mails have corrupted attachments (1 byte size). actionmailer: def send_newsletter(recipient,subject,content,file) @content = content if file attachments[file.original_filename] = { :content=> file.read, :mime_type=> file.content_type } end mail(:to => recipient, :template_name => "deliver_newsletter", :subject =>

How to pass additional data to devise mailer?

99封情书 提交于 2020-01-13 16:56:09
问题 I have a rails app that can handle many subdomains, and I have multiple live versions running with different domain names. This causes the URLs to be anywhere between mywebsite.com company1.mywebsite.com company1.mytestwebsite.com Devise has mailers that use links for resetting passwords and such. These links are sometimes incorrect and send me to the incorrect website because the host name is sometimes different from that of the the default URL from /config/environments/production.rb :