POPAuthenticationError - Mailman Error polling from Gmail account

I am trying to enable the Rails app to receive email from a Gmail account. I follow this screencast: Receiving Email from Mailman .

I tried to poll emails from my Gmail account, so that every time someone sends an email, my application will receive a message and then update the database with this message.

But when I tried to run 'script / mailman_serve' to start the server and polling, I got an error similar to the following:

olins-MacBook-Pro:rentlord Ryzal$ script/mailman_server
I, [2016-02-26T02:07:58.104774 #23700]  INFO -- : Mailman v0.7.3 started
I, [2016-02-26T02:07:58.105083 #23700]  INFO -- : Rails root found in ., requiring environment...
/Users/Ryzal/Desktop/Sites/rentlord/config/application.rb:59: warning: already initialized constant OpenSSL::SSL::VERIFY_PEER
I, [2016-02-26T02:08:07.225640 #23700]  INFO -- : POP3 receiver enabled (@pop.gmail.com).
I, [2016-02-26T02:08:07.266177 #23700]  INFO -- : Polling enabled. Checking every 60 seconds.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:1005:in `check_response_auth': -ERR USER _who_? k19mb6670915wjq (Net::POPAuthenticationError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:905:in `block in auth'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:1012:in `critical'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:904:in `auth'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:566:in `do_start'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/pop.rb:536:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/receiver/pop3.rb:36:in `connect'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/application.rb:139:in `block in polling_loop'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/application.rb:137:in `loop'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/application.rb:137:in `polling_loop'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/application.rb:87:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/mailman-0.7.3/lib/mailman/application.rb:15:in `run'
    from script/mailman_server:25:in `<main>'

And this is my mailman_server file:

#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "mailman"

#Mailman.config.logger = Logger.new("log/mailman.log")

Mailman.config.pop3 = {
  server: 'pop.gmail.com', port: 995, ssl: true,
  username: ENV["xxxxxx@gmail.com"],
  password: ENV["xxxxxx"]
}

Mailman::Application.run do
  default do
    begin
      Post.receive_mail(message)
    rescue Exception => e
      Mailman.logger.error "Exception occurred while receiving message:\n#{message}"
      Mailman.logger.error [e, *e.backtrace].join("\n")
    end
  end
end

Did anyone help? Thank!

############################# UPDATE ######################## #####

POP gmail, . POP:

enter image description here

+4
2

. username .

. , , gemmanmanman . , nil:

#!/usr/bin/env ruby
require "mailman"

username = ''                       
### OR ###
username = 'myownaddress@gmail.com'

puts "Using username='#{username}'..." 
Mailman.config.pop3 = {
  server: 'pop.gmail.com', port: 995, ssl: true,
  username: username, 
  password: 'password'
}
Mailman::Application.run do
  default do
    begin
      puts message 
    rescue Exception => e
      Mailman.logger.error "Exception occurred while receiving message:\n#{message}"
      Mailman.logger.error [e, *e.backtrace].join("\n")
    end
  end
end

Using username=''...
I, [2016-03-02T00:01:44.059312 #16088]  INFO -- : Mailman v0.7.3 started
I, [2016-03-02T00:01:44.059400 #16088]  INFO -- : POP3 receiver enabled (@pop.gmail.com).
I, [2016-03-02T00:01:44.070004 #16088]  INFO -- : Polling enabled. Checking every 60 seconds.
/usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/net/pop.rb:1005:in
 `check_response_auth': -ERR USER _who_? z184mb105814233wlc (Net::POPAuthenticationError)

.

Using username='myownaddress@gmail.com'...

I, [2016-03-02T00:05:35.715465 #16178]  INFO -- : Mailman v0.7.3 started
I, [2016-03-02T00:05:35.715540 #16178]  INFO -- : POP3 receiver enabled (myownaddress@gmail.com@pop.gmail.com).
I, [2016-03-02T00:05:35.726853 #16178]  INFO -- : Polling enabled. Checking every 60 seconds.
I, [2016-03-02T00:06:38.281546 #16178]  INFO -- : Got new message from 'myownaddress@gmail.com' with subject 'http://stackoverflow.com/questions/35642212/popauthenticationerror-mailman-error-when-polling-from-gmail-account'.
Return-Path: <myownaddress@gmail.com>
Received: by 10.79.115.146 with SMTP id y28csa1793673ivf; Tue, 01 Mar 2016 15:06:05 -0800
Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id jm5dsi1257241lbc.1.2016.03.01.15.06.05 for 
(...)
X-Mailer: Apple Mail (2.3124)

http://stackoverflow.com/questions/35642212/popauthenticationerror-mailma=
n-error-when-polling-from-gmail-account=
+2
+2

All Articles