Hey. I had a problem that the test application does not send data to the mail:

Development.rb

Rails.application.configure do config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp # SMTP settings for gmail config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :user_name => ENV['gmail_username'], :password => ENV['gmail_password'], :authentication => "plain", :enable_starttls_auto => true } 

sample_email.text.erb

  <%= @contact.nickname %> <%= @contact.mail %> <%= @contact.theme %> <%= @contact.text %> 

contacts_mailer.rb

 class ContactsMailer < ApplicationMailer default from: "info@mystorelocalhost.com" #template_path: 'contacts_mailer/sample_email' def sample_email(contact) # название вьюхи маилера и аргумент @contact = contact mail(to: 'lmyhope3@gmail.com' , subject: 'Sample Email') end end 

contacts.controller

 class ContactsController < ApplicationController def index @contacts = Contact.all end def new @contact = Contact.new end def show @contact = Contact.find(params[:id]) end def create @contact = Contact.new(contact_params) if @contact.save redirect_to contacts_path ContactsMailer.sample_email(@contact).deliver_now end end private def contact_params params.require(:contact).permit(:nickname, :mail, :theme, :text) end end 

console

  Started POST "/contacts" for 127.0.0.1 at 2016-06-03 14:40:32 +0300 ActiveRecord::SchemaMigration Load (0.4ms) SELECT `schema_migrations`.* FROM `schema_migrations` Processing by ContactsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"kAK/xsE34tm5NyJSitzG2eB/ky38R/9cKq1ooYUgp7JviBlk52S r+uxA3RkI5HS+OKwFGpuC0k2Dmj4VqPTrJg==", "contact"=> {"nickname"=>"testnickname123", "mail"=>"testma123@mail.com", "theme"=>"testtheme123", "text"=>"testtext123"}, "commit"=>"Create Contact"} (0.2ms) BEGIN SQL (0.3ms) INSERT INTO `contacts` (`nickname`, `mail`, `theme`, `text`, `created_at`, `updated_at`) VALUES ('testnickname123', 'testma123@mail.com', 'testtheme123', 'testtext123', '2016-06-03 11:40:32', '2016-06-03 11:40:32') (66.7ms) COMMIT Redirected to http://127.0.0.1:3000/contacts Rendered contacts_mailer/sample_email.text.erb within layouts/mailer (2.1ms) ContactsMailer#sample_email: processed outbound mail in 203.8ms Sent mail to lmyhope3@gmail.com (545.6ms) Date: Fri, 03 Jun 2016 14:40:32 +0300 From: info@mystorelocalhost.com To: lmyhope3@gmail.com Message-ID: <57516cb0a62c9_2f205f21f483369a@g6hp.mail> Subject: Sample Email Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit testnickname123 testma123@mail.com testtheme123 testtext123 Completed 302 Found in 905ms (ActiveRecord: 69.1ms) 

Closed due to the fact that off-topic participants cheops , zRrr , aleksandr barakin , user194374, D-side Jun 20 '16 at 13:34 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - cheops, zRrr, aleksandr barakin, Community Spirit, D-side
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • From: info@mystorelocalhost.com <- not sure if Gmail will approve. Unless at you the mail attached to this domain is used. In ENV you exactly have what you need? Debugger watched? - D-side
  • I kind of half-heartedly set up, Yes, you were right and I was wrong about that too. But now notifications come to the post office, only they fly away to the spam folder. What you do not know? :) - Alexander Tarasovich
  • Take a ride through the mass mailing list checker ( google ), search for jambs in your letters. - D-side

0