2010-05-06 304 views
2

我在rails 2.3.5上安装了最新的Ruby,并且我的应用程序运行良好,除了GMail电子邮件。Rails用GMail发送邮件

我想设置我以前曾工作但现在不想知道的gmail imap连接。

这是我的代码:

# Be sure to restart your server when you modify this file 

# Uncomment below to force Rails into production mode when 
# you don't control web/app server and can't set it the proper way 
# ENV['RAILS_ENV'] ||= 'production' 

# Specifies gem version of Rails to use when vendor/rails is not present 
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION 

# Bootstrap the Rails environment, frameworks, and default configuration 
require File.join(File.dirname(__FILE__), 'boot') 


Rails::Initializer.run do |config| 
    # Gems 
    config.gem "capistrano-ext", :lib => "capistrano" 
    config.gem "configatron" 

    # Make Time.zone default to the specified zone, and make Active Record store time values 
    # in the database in UTC, and return them converted to the specified local zone. 
    config.time_zone = "London" 

    # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. 
    # All files from config/locales/*.rb,yml are added automatically. 
    # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] 
    #config.i18n.default_locale = :de 

    # Your secret key for verifying cookie session data integrity. 
    # If you change this key, all old sessions will become invalid! 
    # Make sure the secret is at least 30 characters and all random, 
    # no regular words or you'll be exposed to dictionary attacks. 
    config.action_controller.session = { 
    :session_key => '_base_session', 
    :secret  => '7389ea9180b15f1495a5e73a69a893311f859ccff1ffd0fa2d7ea25fdf1fa324f280e6ba06e3e5ba612e71298d8fbe7f15fd7da2929c45a9c87fe226d2f77347' 
    } 

    config.active_record.observers = :user_observer 

end 

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(:default => '%d/%m/%Y') 
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(:default => '%d/%m/%Y') 

require "will_paginate" 

ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
    :enable_starttls_auto => true, 
    :address => "smtp.gmail.com", 
    :port => 587, 
    :domain => "XXXXXXXX.XXX", 
    :authentication => :plain, 
    :user_name => "XXXXXXXXXX.XXXXXXXXXX.XXX", 
    :password => "XXXXX" 
} 

但上述只是导致生产日志的SMTP认证错误。

我已阅读了Rails 2.2.2中的这个不适用的报告,但2.3.5没有任何意见,任何人有任何想法?

感谢,

丹尼

回答