我在配置文件中有这个
myApp::Application.configure do
config.cache_classes = false
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
config.action_mailer.smtp_settings = {
:address => 'mailhost.mycom.com',
:port => 25
}
end
#log ActiveRecord
ActiveRecord::Base.logger = Logger.new(STDOUT) if defined? Rails::Console
我收到错误
scheduler caught exception :
501 5.1.3 Invalid address
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:930:in `check_response'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:899:in `getok'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:842:in `rcptto'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:834:in `rcptto_list'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:833:in `each'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:833:in `rcptto_list'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:654:in `send_message'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/mail-2.2.15/lib/mail/network/delivery_methods/smtp.rb:128:in `deliver!'
classpath:/META-INF/jruby.home/lib/ruby/1.8/net/smtp.rb:526:in `start'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/mail-2.2.15/lib/mail/network/delivery_methods/smtp.rb:127:in `deliver!'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/mail-2.2.15/lib/mail/message.rb:1967:in `do_delivery'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/mail-2.2.15/lib/mail/message.rb:228:in `deliver'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/actionmailer-3.0.5/lib/action_mailer/base.rb:403:in `deliver_mail'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/activesupport-3.0.5/lib/active_support/notifications.rb:52:in `instrument'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/activesupport-3.0.5/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/activesupport-3.0.5/lib/active_support/notifications.rb:52:in `instrument'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/actionmailer-3.0.5/lib/action_mailer/base.rb:401:in `deliver_mail'
/usr/local/webservices/tmp/0-odms/WEB-INF/gems/gems/mail-2.2.15/lib/mail/message.rb:228:in `deliver'
我已在日志文件中打印出cc / to电子邮件地址。他们很好。电子邮件列表包括域外的一些人。此电子邮件通常包含Excel附件。但是想知道为什么我会收到这个错误。
代码:
def sendmail(co, attach)
@co
Rails.logger.info "co in notice : "+"#{co}"
attachments["Report_#{co}_#{Time.now}.xls"] = {:mime_type => 'application/vnd.ms-excel',
:content => attach.string} unless attach.nil?
mail :to => to,
:cc => cc,
:priority => 'Urgent',
'X-Priority' => '1',
:importance => 'high'
end