actionmailer

Rails: ParameterFilter::compiled_filter tries to dup symbol

笑着哭i 提交于 2019-12-19 08:12:06
问题 I'm running rails3 with rails exception-notifier gem. When an exception occurs, and an email should be sent, I'm getting an exception from the ParameterFilter class. I've found the problem in the rails source, and am not sure the best way to proceed. The problem occurs in ActionDispatch::Http::ParameterFilter. In the compiled_filter method, an error occurs on line 38: key = key.dup when key is a symbol, because symbols are not duplicable. Here is the source: def compiled_filter ... elsif

Rails 3 Render Prawn pdf in ActionMailer

↘锁芯ラ 提交于 2019-12-19 02:27:19
问题 How to render prawn pdf as attachment in ActionMailer? I use delayed_job and don't understand, how could I render pdf-file in action mailer (not in controller). What format should I use? 回答1: You just need to tell Prawn to render the PDF to a string, and then add that as an attachment to the email. See the ActionMailer docs for details on attachments. Here's an example: class ReportPdf def initialize(report) @report = report end def render doc = Prawn::Document.new # Draw some stuff... doc

paperclip + ActionMailer - Adding an attachment?

。_饼干妹妹 提交于 2019-12-18 15:35:28
问题 I have a paperclip'd file that I want to add as an attachment to my email.... class UserMailer < ActionMailer::Base def XXXXXX_notification(record) @record = record attachments ??? How to add a paperclip file? mail( :to => "#{record.email}", :subject => "XXXXXXXX" ) end There seems to be nothing on the topic via google, if you have any ideas, I'd love to hear it :) Thanks UPDATE @comment.attachments.each do |a| tempfile = File.new("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}", "w")

How do I configure the hostname for Rails ActionMailer?

▼魔方 西西 提交于 2019-12-18 11:49:13
问题 I'm working on a fairly traditional forgot password email - I want to email the user a password change token embedded in a link that they can click on in order to change their password. I'm emailing via the traditional ActionMailer. If I use a normal link_to tag <%= link_to "click here", :controller => foo, :action => 'bar', :token => token %> I get a relative link - rather useless from an email. If I add in :only_path => false , then it errors saying I need to set default_url_options[:host]

How do I create email with css and images from Rails?

帅比萌擦擦* 提交于 2019-12-18 10:52:09
问题 How do you create and send emails from Rails application, that contain images and proper formatting? like the ones you get from facebook and like. 回答1: Assuming you know how to send normal plain-text emails from Rails using ActionMailer, to get HTML emails working you need to set a content type for your email. For example, your notifer might look like this: class MyMailer < ActionMailer::Base def signup_notification(recipient) recipients recipient.email_address_with_name subject "New account

Rails - How do you test ActionMailer sent a specific email in tests

*爱你&永不变心* 提交于 2019-12-18 10:16:57
问题 Currently in my tests I do something like this to test if an email is queued to be sent assert_difference('ActionMailer::Base.deliveries.size', 1) do get :create_from_spreedly, {:user_id => @logged_in_user.id} end but if i a controller action can send two different emails i.e. one to the user if sign up goes fine or a notification to admin if something went wrong - how can i test which one actually got sent. The code above would pass regardless. 回答1: When using the ActionMailer during tests,

ActionMailer and Ramaze

∥☆過路亽.° 提交于 2019-12-18 06:22:10
问题 Is it possible to use ActionMailer in a web framework like Ramaze, or do I need to use Rails? 回答1: You can use ActionMailer without Rails quite easily. I'm not familiar with Ramaze, but here's plain ruby, which should be easy to integrate into whatever framework you wish: PATH/mailer.rb require 'rubygems' require 'action_mailer' class Mailer < ActionMailer::Base def my_email recipients "recipient@their_domain.com" from "me@my_domain.com" subject "my subject" body :variable1 => 'a', :variable2

Ruby on Rails 3.2 Mailer, localize mail subject field

你说的曾经没有我的故事 提交于 2019-12-18 04:54:11
问题 I'm currently writing a mailer in RoR 3.2 that would send out mails that should be localized based on a users' language. I managed to render the correct localized views but I'm having some difficulties with some fields that require changing the locale (like the subject). I've already read some posts that are against changing the locale before sending the email. The users have many different languages and that would mean changing my locale every time a user is sent an email. I know that it

Rails 4 ActionMailer with gmail Net::SMTPAuthenticationError: 534-5.7.14

梦想的初衷 提交于 2019-12-18 03:57:45
问题 I am trying to send an email in development version of my app. Nothing I am doing is working. I keep getting hit with: Net::SMTPAuthenticationError: 534-5.7.14 https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=blahblahblah Other SO posts I have followed: Net::SMTPAuthenticationError when sending email from Rails app (on staging environment) Running into SMTP error when trying to send email in RoR app ... etc... and nothing works. I'm going to tear my brains out if can't be resolved.

How de we send out 5000 emails per hour using actionmailer in ruby on rails?

爱⌒轻易说出口 提交于 2019-12-17 19:03:48
问题 I have some questions about ActionMailer : How does Actionmailer connect to a smtp server ? Are the connections concurrent or parallel if the number of emails high > 1000 ? How will sending out emails like facebook does ( 1000's in numbers ) as immediate emails affect the ruby on rails application and how would actionmailer handle it ? Any other solution/plugin to send out large number emails from a RoR application apart ActionMailer? ------------------------------------------------added : We