actionmailer

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

老子叫甜甜 提交于 2019-12-17 19:01:57
问题 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

Where do I put helper methods for ActionMailer views?

情到浓时终转凉″ 提交于 2019-12-17 18:48:48
问题 I have a method that takes an array of strings and joins them so they do something like this: >> my_arr => ["A", "B", "C"] >> and_join(my_arr) => "A, B, and C" Which I'd like my mailer to have access to so I can output some information into an email. I can't seem to find a good place to put it and putting it in the application_helper.rb file and it doesn't find it there. Where should it go? 回答1: Use the helper method in your mailer to define the helper class to use # mailer_helper.rb module

Getting Devise 1.3.4 to send emails with Gmail in development

自古美人都是妖i 提交于 2019-12-17 18:29:52
问题 I'm trying to setup devise 1.3.4 to send emails via gmail while in development mode. I should mention that I'm using Rails 3.0.4 and Ruby 1.9.2p136. I've tried the following in config/environments/development.rb: config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_deliveries = true config.action_mailer.default_url_options = { :host => 'mydomain.com' } ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "mydomain.com", :user

ActionMailer not sending mail in development Rails 4

蹲街弑〆低调 提交于 2019-12-17 10:37:08
问题 Why is this mailer not sending any mail? (Or any ideas for debugging?) In my_app/config/environments/development.rb I have this code: config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, domain: 'my_app.com', user_name: ENV['GMAIL_USERNAME'], password: ENV['GMAIL_PASSWORD'], authentication: 'plain', enable_starttls_auto: true } Then on my local computer in ~/.bash_profile I have this code: export GMAIL_USERNAME='blah@my_app

How to attach xls files to email when sending from rails, and not getting the attachment corrupt?

烈酒焚心 提交于 2019-12-14 02:26:43
问题 If I attach xls files as attachment in the mailer like this attachments["1.xls"] = File.read "1.xls" If I try open the attachment from the received mail, Excel is unable to open and it says the file is corrupted. Please let me know if I am missing something? Please let me know if additional information is needed? 回答1: Found the answer here http://www.dixis.com/?paged=3 Apparently The correct way to attach binary files on Windows is attachments[file_name] = File.open(file_location, 'rb'){|f| f

Graceful degradation/progressive enhancement for Action Mailer templates?

家住魔仙堡 提交于 2019-12-13 14:38:20
问题 Is there some gem or technique that will let us write only .html.erb templates for our Rails 3 mailers, and gracefully degrade them by stripping HTML tags for the text/plain version, rather than having to create each partial twice? Google is seriously failing me, so I must be searching for the wrong terms. 回答1: take a look at premailer. It can generate text from html. In general, this is not an easy problem. It might be easier if we were able to write semantic html markup and then it'd be

Rails HTML/TEXT UserMailer Templates

大城市里の小女人 提交于 2019-12-13 14:21:35
问题 Currently for my Rails 3 mailer templates, I need to create an html and text version in the views/user_mailer directory . Why is that necessary? Why can't rails look at the html version and automatically format it to a text/plain version? 回答1: This is not required. You can simply provide one of those templates. For instance, if you don't need HTML, you can create the TEXT file only. Likewise, you can provide the HTML template only. Readers will attempts to extract the information. However, if

SASL LOGIN authentication failed: Invalid authentication mechanism on Rails using Postfix and Dovecot on Ubuntu 12.10 [closed]

吃可爱长大的小学妹 提交于 2019-12-13 12:17:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have configured an ubuntu 12.10 server with Postfix and Dovecot. Nonetheless, I have SASL Login authentication problem when I try to send emails using a rails web application. Using RoundCube Webmail, I get this log when I send an email: Feb 21 21:09:01 ks400054 postfix/qmgr[17883]: 61D4E113: removed Feb 21 21

How to include ActionMailer class in rake task?

本小妞迷上赌 提交于 2019-12-13 11:57:02
问题 I want to use ActionMailer in my rake task in order to send emails to people at a particular time. I have written a mailer class in app/mailers folder like this: class AlertsMailer < ActionMailer::Base default from: 'x@y.com' def mail_alert(email_addresses, subject, url) @url = '#{url}' mail(to: email_addresses, subject: 'Alert') do |format| format.html { render '/alerts/list' } end end end Then I included the following line in my rake task: AlertsMailer.mail_alert(email_addresses, subject)

Conditional logic in Rails/ActionMailer for two versions of same article to readers/subscribers

戏子无情 提交于 2019-12-13 07:00:11
问题 Users are either readers or subscribers. When a new article is published, subscribers get a full text e-mail, readers get a teaser text. Assuming scopes in the model for readers/subscribers, is this right or do I need another conditional for each type of user? if @article.valid? User.subscribers.each do |user| ArticleMailer.send_article_full(@article, user).deliver_now end User.readers.each do |user| ArticleMailer.send_article_teaser(@article, user).deliver_now end redirect_to :root, notice: