Rails SocketError

时间:2016-01-17 17:35:12

标签: ruby-on-rails mailman

我正在尝试使用 mailman 访问 outlook 的邮件但是我收到了错误消息。
getaddrinfo:名称或服务未知
我能用代码做gmail,但是当我尝试使用outlook时,它给了我错误 [outlook_controller]

require "rubygems"
require "bundler/setup"
require "mailman"

class OutlooksController < ApplicationController
    def index
        Mailman.config.poll_interval = 5  # change this number as per your needs. Default is 60 seconds
    Mailman.config.pop3 = {
  server: 'pop.outlook.com', port: 995, ssl: true,
  username: "user-name",
  password: "pass"
}
  Mailman::Application.run do
  default do
    begin
    p "Found a new message"
    p message.from.first # message.from is an array
    p message.to.first # message.to is an array again..
    p message.subject
    rescue Exception => e
      Mailman.logger.error "Exception occurred while receiving message:n#{message}"
      Mailman.logger.error [e, *e.backtrace].join("n")
    end
  end
end

0 个答案:

没有答案