邮件未送达Gmail Rails开发

时间:2015-04-06 03:11:03

标签: ruby-on-rails email contact-form mail-form

为什么联系表单电子邮件不会进入我的收件箱?我正在使用Mail form gem 联系表单成功提交后,我的服务器中显示的内容是否在我的收件箱中显示无电子邮件:

    Started GET "/assets/static_pages-fcec5b5a277ac7c20cc9f45a209a3bcd.js?     body=1" for ::1 at 2015-04-05 21:45:16 -0500


    Started POST "/contacts" for ::1 at 2015-04-05 21:45:42 -0500
    Processing by ContactsController#create as */*
    Parameters: {"utf8"=>"✓","authenticity_token"=>"xXXdK5vV8XncTG9ohjC6B0/V5N/s+wWDpxJlBq6h62KaHMtmRpkj1lUATQc6U+evtPFJ0eOv64lfhIyt9LRSsQ==", "contact"=>{"name"=>"Luke", "email"=>"Wip@mac.com", "message"=>"wjfejwfjeowf4i43fj4jfsdjkofjdsjfdojsdfkodsjicdowirbfrerjhgjs"}, "commit"=>"Send Message"}
    DEPRECATION WARNING: `#deliver` is deprecated and will be removed in Rails 5. Use `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job. (called from create at /Users/corneliusmurphy/spartan_strength_and_power/app/controllers/contacts_controller.rb:9)
    Rendered /usr/local/lib/ruby/gems/2.2.0/gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (0.7ms)

      MailForm::Notifier#contact: processed outbound mail in 98.0ms

      Sent mail to neil.murphy05@yahoo.com (4.7ms)
      Date: Sun, 05 Apr 2015 21:45:42 -0500
      From: Luke <Wip@mac.com>
      To: neil.murphy0600@gmail.com
      Message-ID: <5521f3569f933_4e243fed2c1af474541a1@CorneliussMBP3.mail>
      Subject: My Contact Form
      Mime-Version: 1.0
      Content-Type: text/html;
      charset=UTF-8
      Content-Transfer-Encoding: 7bit

      <h4 style="text-decoration:underline">My Contact Form</h4>


       <p><b>Name:</b>
        Luke</p>

       <p><b>Email:</b>
       Wip@mac.com</p>

       <p><b>Message:</b>
       wjfejwfjeowf4i43fj4jfsdjkofjdsjfdojsdfkodsjicdowirbfrerjhgjs</p>


      Rendered contacts/create.html.erb within layouts/application (0.1ms)
      Rendered layouts/_header.html.erb (0.8ms)
      Rendered layouts/_messages.html.erb (0.5ms)
      Rendered layouts/_footer.html.erb (0.4ms)
      Completed 200 OK in 352ms (Views: 246.9ms | ActiveRecord: 0.0ms)

这是我的development.rb

      Rails.application.configure do

               config.cache_classes = false

               config.eager_load = false

               config.consider_all_requests_local       = true

               config.action_controller.perform_caching = false

               config.active_support.deprecation = :log

              config.active_record.migration_error = :page_load

              config.assets.debug = true

              config.assets.digest = true

              config.assets.raise_runtime_errors = true
              config.assets.compile = true
              config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

              config.action_mailer.perform_deliveries = true
              config.action_mailer.raise_delivery_errors= true
              config.action_mailer.delivery_method = :smtp
              config.action_mailer.smtp_settings = {
              address:              'smtp.gmail.com',
              port:                 587,
              domain:               'spartanstrengthandpower.com',
              user_name:            'MyGmail.com',
              password:             'MyPassword',
              authentication:       'plain',
              enable_starttls_auto: true  }

            end

1 个答案:

答案 0 :(得分:1)

您需要在配置文件中设置config.action_mailer.perform_deliveries = true

From the docs

  

确定在邮件消息上调用传递方法时是否实际执行传递。