Questions tagged [actionmailer]

Action Mailer is a framework for designing email service layers. Original ActionMailer is written in Ruby, but there is also implementation for ASP.NET MVC.

Action Mailer is a framework for designing email service layers. These layers are used to consolidate code for sending out forgotten passwords, welcome wishes on signup, invoices for billing, and any other use case that requires a written notification to either a person or another system.

Action Mailer is in essence a wrapper around Action Controller and the Mail gem. It provides a way to make emails using templates in the same way that Action Controller renders views using templates.

Additionally, an Action Mailer class can be used to process incoming email, such as allowing a blog to accept new posts from an email (which could even have been sent from a phone).

2387 questions
186
votes
6 answers

Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]

I am trying to push my app on heroku. I am still in dev. I use devise with the confirmable module. When I try to add a user with the heroku console I got this error: Missing host to link to! Please provide :host parameter or set…
benoitr
  • 6,025
  • 7
  • 42
  • 67
139
votes
3 answers

How do I set up email confirmation with Devise?

Is there a tutorial out there that explains how to set up Devise's signup confirmation email from scratch (in both development and production), i.e. if you don't have Action Mailer set up? Google searching has just turned up a bunch of separate…
jyli7
  • 2,731
  • 6
  • 23
  • 31
116
votes
7 answers

Rails ActionMailer - format sender and recipient name/email address

Is there a way to specify email AND name for sender and recipient info when using ActionMailer? Typically you'd do: @recipients = "#{user.email}" @from = "info@mycompany.com" @subject = "Hi" @content_type = "text/html" But, I want…
Grnbeagle
  • 1,751
  • 2
  • 16
  • 26
90
votes
14 answers

How to test ActionMailer deliver_later with rspec

trying to upgrade to Rails 4.2, using delayed_job_active_record. I've not set the delayed_job backend for test environment as thought that way jobs would execute straight away. I'm trying to test the new 'deliver_later' method with RSpec, but I'm…
bobomoreno
  • 2,848
  • 5
  • 23
  • 42
88
votes
2 answers

How to define a reply-to address?

How can I define a reply-to address different than the :from one? Is that even possible?
empz
  • 11,509
  • 16
  • 65
  • 106
71
votes
7 answers

What is the right way to embed image into email using Rails?

What is the right way to embed an image into email using Rails?
Alexey Zakharov
  • 24,694
  • 42
  • 126
  • 197
64
votes
3 answers

Clearing out ActionMailer::Base.deliveries after RSpec test

I have the following RSpec test for my UserMailer class: require "spec_helper" describe UserMailer do it "should send welcome emails" do ActionMailer::Base.deliveries.should be_empty user = Factory(:user) …
Kevin Pang
  • 41,172
  • 38
  • 121
  • 173
62
votes
5 answers

Send to multiple recipients in Rails with ActionMailer

I'm trying to send multiple emails based on a boolean value in my database. The app is a simple scheduling app and user can mark their shift as "replacement_needed" and this should send out emails to all the users who've requested to receive these…
Slick23
  • 5,827
  • 10
  • 41
  • 72
55
votes
3 answers

image_tag in mailer not using asset_host

image_tag isn't using the asset_host I've set. Any ideas why? The only thing I can think of is it having to do with it being a Mailer. config/environment/development.rb config.action_controller.asset_host = "http://localhost:3000" myMailer.rb <%=…
RyanJM
  • 7,028
  • 8
  • 60
  • 90
55
votes
6 answers

How can I send mail with rails without a template?

In my Rails 3 project, I want to send some simple notification emails. I don't need to make a template for them or do any logic. I just want to fire them off from various places in the system. If I were doing this in an arbitrary ruby script I would…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
54
votes
8 answers

Sending mail with Rails 3 in development environment

I'm sure this has been asked a million times before but I can't find anything that works for me so I'm asking again! I just need a way of sending emails using ActionMailer in rails 3. I have followed numerous tutorials including the Railscasts…
Addsy
  • 3,944
  • 2
  • 32
  • 35
53
votes
7 answers

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

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…
robodisco
  • 4,162
  • 7
  • 34
  • 48
52
votes
8 answers

Errno::ECONNREFUSED: Connection refused - connect(2) for action mailer

I have been working with rails since a long. Now I am facing a small issue in the ActionMailer. I want to send an email when user gets registered to confirm his registration. I am able to send email in the development mode but where as not in the…
VenkatK
  • 1,295
  • 1
  • 9
  • 21
49
votes
5 answers

Rails - Mail, getting the body as Plain Text

Given: message = Mail.new(params[:message]) as seen here: http://docs.heroku.com/cloudmailin It shows how to get the message.body as HTML, how to do you get the plain/text version? Thanks
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
48
votes
5 answers

ActionMailer not sending mail in development Rails 4

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: …
Don P
  • 60,113
  • 114
  • 300
  • 432
1
2 3
99 100