Tôi đang cố gắng tạo một ứng dụng, sẽ gửi email khi người dùng đăng ký.Người gửi thư không gửi thư, có đường ray 3
tôi đặt trong các thiết lập smtp cho gmail trong config/tập tin application.rb và các chức năng thư trông giống như
mail(:to => "[email protected]", :subject => "Mail!", :from => "[email protected]", :content_type => "text/html")
bây giờ khi tôi thấy các bản ghi, tôi thấy rằng nó nói email đã được gửi đi, nhưng tôi không bao giờ nhận được bất kỳ thư nào ...
Ngoài ra, khi tôi gọi chức năng gửi thư, Emails.signed(@user).deliver
, trang biểu mẫu không chuyển hướng, nhưng nó hoạt động nếu tôi nhận xét mã gửi email là
Emails.signed(@user).deliver
hoặc
mail(:to => "[email protected]", :subject => "Mail!", :from => "[email protected]", :content_type => "text/html")
Cảm ơn :)
Edit: development.rb
App::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
end
Bạn đang cố gắng gửi nó vào quá trình phát triển? hãy dán tệp 'development.rb' hoặc' production.rb'. – jpemberthy
Tôi đang ở chế độ phát triển ... tôi đã thêm development.rb – Amit
Vui lòng kiểm tra bài đăng sau và cho chúng tôi biết nếu bạn tiếp tục gặp sự cố. http://asciicasts.com/episodes/206-action-mailer-in-rails-3 Nó sẽ hoạt động nếu bạn đã thiết lập đúng cài đặt gmail smtp của mình. – jpemberthy