I am trying to enable my Rails application to receive email from a Gmail Account. I follow this screencast : Receiving Email with Mailman .
I tried to the the polling for emails from my Gmail account, so that everytime somebody send an email, my app will receive the message and then update the database with this message accordingly.
But when I tried to run 'script/mailman_serve' to start the server and the polling, I got an error like this one below:
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
Could anybody help? Thanks!
########################### UPDATE ##########################
I also have enable POP setting on my gmail account, but still the same error occurs. This is my POP setting: