2

我正在尝试使用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
4

0 回答 0