【发布时间】:2014-11-18 08:37:16
【问题描述】:
我的邮件在等待后没有发送任何内容,我不知道为什么。我也试过deliver_now
当我转到 URL http://localhost:3000/send_mail 时,我没有收到任何错误,只是一个空白页。
我的终端状态:
Started GET "/send_mail" for ::1 at 2014-11-18 00:32:39 -0800
Processing by HomeController#send_mail as HTML
ActionMailer::Base#mail: processed outbound mail in 1.2ms
Sent mail to myemail@gmail.com (1.2ms)
Date: Tue, 18 Nov 2014 00:32:39 -0800
From: me@example.com
To: myemail@gmail.com
Message-ID: <546b0427e5677_82b3ffd9e6809bc2363f@MTVL1289dd026.local.mail>
Subject: Contact request
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
test
Rendered text template (0.0ms)
Completed 200 OK in 4ms (Views: 0.2ms | ActiveRecord: 0.0ms)
::1 - - [18/Nov/2014:00:32:39 -0800] "GET /send_mail HTTP/1.1" 200 - 0.0066
config/environments/development.rb
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :test
host = 'localhost:3000'
config.action_mailer.default_url_options = { host: host }
家庭控制器:
class HomeController < ApplicationController
def index
end
def send_mail
ActionMailer::Base.mail(:from => "me@example.com", :to => "myemail@gmail.com", :subject => "Contact request", :body => "test").deliver
render nothing: true
end
end
routes.rb
match '/send_mail', to: "home#send_mail", via: "get"
【问题讨论】:
-
smtp_settings设置? -
@Nithin 拍摄。我现在正在学习 Rails。我不知道这个=[
标签: ruby-on-rails actionmailer