actionmailer

Rails 3: SMTP Settings for Hotmail/Live Hosted Email

[亡魂溺海] 提交于 2019-12-21 12:11:29
问题 I'm having an issue properly setting up my web application to use Windows Live Hosted email instead of the normal Google Apps Email. This is due to the fact that Google is down charging for such services. I've entered in the proper config.action_mailer.smtp_settings, but for some reason I can't get email notifications to properly send. My config below, if I swap the config with another Google Apps config settings email, it's functional. Am I missing something? config.action_mailer.smtp

ActionMailer password security

不问归期 提交于 2019-12-21 03:59:17
问题 Am I crazy, or is it a bad idea to keep my SMTP username and password for ActionMailer in the actual (development/production) config file? It seems like I should store it an encrypted place, or at the very minimum, exclude it from my Mercurial pushes. Right now, I'm just removing the password from my source file before performing a push, but there's got to be a smarter way than the one I'm using. :) Perhaps I should store it in my database as another user (which is already stored with

Save each email before sending rails 4

痞子三分冷 提交于 2019-12-21 02:42:15
问题 I want to keep track of all triggered emails by the application into a db table, so that i can have a log which emails are sent and to whom. Kindly suggest me the best possible solution. 回答1: I have solved this using the following way: created a class in lib directory class MyProjectMailLogger def self.delivering_email(message) @to = message.to.to_s @subject = message.subject.to_s @message = message.body.to_s EmailQueue.create!(:receipient_email => @to, :subject => @subject, :message =>

How can I send emails in Rails 3 using the recipient's locale?

一世执手 提交于 2019-12-20 11:14:34
问题 How can I send mails in a mailer using the recipient's locale. I have the preferred locale for each user in the database. Notice this is different from the current locale (I18n.locale), as long as the current user doesn't have to be the recipient. So the difficult thing is to use the mailer in a different locale without changing I18n.locale: def new_follower(user, follower) @follower = follower @user = user mail :to=>@user.email end Using I18n.locale = @user.profile.locale before mail :to=>..

Rails - How to test that ActionMailer sent a specific attachment?

烈酒焚心 提交于 2019-12-20 11:07:10
问题 In my ActionMailer::TestCase test, I'm expecting: @expected.to = BuyadsproMailer.group_to(campaign.agency.users) @expected.subject = "You submitted #{offer_log.total} worth of offers for #{offer_log.campaign.name} " @expected.from = "BuyAds Pro <feedback@buyads.com>" @expected.body = read_fixture('deliver_to_agency') @expected.content_type = "multipart/mixed;\r\n boundary=\"something\"" @expected.attachments["#{offer_log.aws_key}.pdf"] = { :mime_type => 'application/pdf', :content => fake_pdf

ActionMailer testing with rspec [closed]

这一生的挚爱 提交于 2019-12-20 09:10:06
问题 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 5 years ago . I am developing a Rails 4 application which involves sending / receiving emails. For example, I send emails during user registration, user comment, and other events in the app. I have created all emails using the action mailer , and I used rspec and shoulda for testing. I need to test if the mails are received

Rails 3 - Devise/ActionMailer/RUBY-SMTP causing a segmentation fault

大兔子大兔子 提交于 2019-12-20 05:57:09
问题 OK - I'm in way over my head here. I'm using: - ruby-1.9.3-p0 - rails-3.1.3 - mail-2.3.0 - devise-1.5.3 Trying to turn on Devise's :confirmable option and start up smtp services in my app. As soon as I add /config/initializers/setup_mail.rb , add Devise's necessary columns in my DB, and the :confirmable attribute to my User model, I get a segmentation fault. It occurs right after a user signs up. Devise is trying to send out the confirmation email, causing the ruby smtp library to crash with

Why Rails instance method can be used as class method in rspec

↘锁芯ラ 提交于 2019-12-20 03:22:54
问题 I found a snippet in an article about sending mails in a Rails application: class ExampleMailerPreview < ActionMailer::Preview def sample_mail_preview ExampleMailer.sample_email(User.first) end end in this link: http://www.gotealeaf.com/blog/handling-emails-in-rails. I do not know why the method: sample_email() , which in my mind should be an instance method, can be accessed like class method here as ExampleMailer.sample_email() . Can anyone explain? 回答1: It's not an rspec thing, it's an

Ruby/Rails ActionMailer not working with NTLM

China☆狼群 提交于 2019-12-20 02:54:57
问题 I am setting up a mailer in my project and I am having difficulties sending mail through Exchange SMTP server. I have installed the gem ruby-ntlm but I am still getting unrecognized authentication type . This is my code environment.rb # Load the Rails application. require File.expand_path('../application', __FILE__) require 'ntlm/smtp' # Initialize the Rails application. Rails.application.initialize! notifier.rb class Notifier < ActionMailer::Base default :from => "stephen.edwards@foostix.lu"

Rails mail interceptor only for a specific mailer

末鹿安然 提交于 2019-12-19 08:29:10
问题 I have an interceptor : DevelopmentMailInterceptor and an inititializer setup_mail.rb that initiates the interceptor. But I want to apply it to a specific mailer (to intercept NotificationMailer and not the other ones. So I set in setup_mail.rb : `NotificationMailer.register_interceptor(DevelopmentMailInterceptor) But then all mailers get intercepted, as if I'd written ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) How can I filter this? 回答1: I found the solution by