actionmailer

Sending large email attachments with actionmailer and heroku from s3

℡╲_俬逩灬. 提交于 2019-12-11 03:38:39
问题 i have an app that stores uploaded files in s3, once complete a mail is sent with the attached file. The app works fine when attachments are between 0-15 Mb in size. However when i attached something larger like 16 Mb it fails and returns the error: Net::SMTPFatalError: 550 Could not send e-mail, max size of 20480000 bytes exceeded 1). Firstly i do not understand why it fails as, 16Mb < 20480000 bytes(+/-19 Mb) 2). How can i mail files larger than 19Mb I am using heroku's sendgrid addon, and

Rails 5: ActionMailer's “deliver_later” never delivers in production

坚强是说给别人听的谎言 提交于 2019-12-11 02:45:43
问题 I have a very basic mailer setup as follows to send out transactional mailers: class PayoutMailer < ApplicationMailer default from: 'hello@groundworkai.com' def payout_success_email(email, payment_size, user_name) @payment_size = payment_size @user_name = user_name subject = 'Your Rewards Have Been Sent!' mail(to: email, from: 'hello@myservice.com', subject: subject) end end Which I'm testing with this line: PayoutMailer.payout_success_email('test@example.com', 200000, 'test name').deliver

problem with Actionmailer “Timeout::Error”?

被刻印的时光 ゝ 提交于 2019-12-11 02:10:46
问题 im trying to send a email with action mailer and it gives me a Timeout::Error (execution expired): even though in the console it says that the e mail is sent: it shows Sent mail to aldeirm2@gmail.com then displayes the e mail that was sent then it shows the following error: Timeout::Error (execution expired): /usr/lib/ruby/1.8/timeout.rb:60:in `open' /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start' /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start' /usr/lib/ruby/1.8/net/smtp.rb:525:in `start' app

Rails different Devise Mailer layout for the same action

前提是你 提交于 2019-12-11 00:51:30
问题 I have a model User that has multiple referenced "profiles". A user can have several of those profiles, and each of those profiles should induce a specific layout in emails. Let's consider the profiles Admin and Worker For example, in my Devise confirmation controller, I need different layouts depending on the profile the user have. For example, if the user has Admin profile : render admin template Worker profile : render worker template Both : render another template (hybrid) Therefore I

rails 3 email sending problem

末鹿安然 提交于 2019-12-11 00:35:24
问题 I am using Rails 3 and implementing the email sending feature. I am not sure if my configuration is correct, but here are my codes: mailers/user_mailer.rb class UserMailer < ActionMailer::Base default :from => "user@gmail.com" def send_to(user) @user = user subject='welcome !' mail(:to=>'y.lan@gmail.com', :subject=>subject, :content_type => "text/html") mail.deliver end end controller : def CarsController < BaseController ... def register_finish UserMailer.send_to(user) end end config

Unable to render inline attachments in ActionMailer

我与影子孤独终老i 提交于 2019-12-10 22:14:54
问题 I'm trying to render inline images in a standard ActionMailer view using the approach outlined here Rails attachments inline are not shown correctly in gmail. My code in my mailer: attachments.inline["sample.png"] = { mime_type: "image/png", encoding: "base64", # Including this line causes byte sequence error data: File.read('public/sample.png') } In mail view: image_tag(attachments["sample.png"].url) Gives the familiar ruby UTF-8 byte sequence error: invalid byte sequence in UTF-8 To get

Rails - Send all emails with delayed_job asynchronously

折月煮酒 提交于 2019-12-10 18:59:30
问题 I'm using delayed_job and I'm very happy with it (especially with the workless extension). But I'd like to set that ALL mails from my app are sent asynchronously. Indeed, the solution offered for mailers # without delayed_job Notifier.signup(@user).deliver # with delayed_job Notifier.delay.signup(@user) doesn't suit me because: it is not easily maintainable mails sent from gems are not sent asynchronously (devise, mailboxer) I could use this kind of extension https://github.com/mhfs/devise

Send User email after creating a post, with Action Mailer

本小妞迷上赌 提交于 2019-12-10 18:51:46
问题 I have a User model (with Devise), and a Post model that belongs to the user. I used this railscast (pro) to send the User an email after creating an account I created a "NewPostMailer" This is my mailer: class NewPostMailer < ActionMailer::Base default :from => "email@gmail.com" def new_post_email(user) @user = user @url = "http://localhost.com:3000/users/login" mail(:to => user.email, :subject => "New Post") end end My posts_controller: def create @post= Post.new(params[:post]) respond_to

ActionMailer sometimes not sending?

邮差的信 提交于 2019-12-10 17:54:52
问题 I have a problem where ActionMailer sometimes doesn't send emails. It is reproducible and affects certain people at certain times, although what is causing it is a mystery. It fails silently, although config.action_mailer.raise_delivery_errors = true is set. It enters the mail() routine, claims it has rendered the template: Rendered notifier/notify_comment.html.erb (0.9ms) And then skips the delivery and moves onto the next one. The next one is rendered & delivered no problem. When emails are

Rails ActiveJob - What's the good way to handle exception in ActionMailer::DeliveryJob

 ̄綄美尐妖づ 提交于 2019-12-10 16:38:11
问题 I am using ActiveJob + Sidekiq in my Rails project for task processing. I send my mails directly using MyMailer.some.deliver_later . It will automatically creates a ActionMailer::DeliveryJob task and put it in the Sidekiq queue. The question is, what's the good to handle exceptions from there? Best Regards. 回答1: According to http://edgeguides.rubyonrails.org/active_job_basics.html, I think the good way is to setup exception error handlers for ActionMailer::DeliveryJob in an initializer,