class EmailProbe::SMTPConnection
Attributes
port[R]
server[R]
Public Class Methods
new(server, port)
click to toggle source
# File lib/email_probe/smtp_connection.rb, line 10 def initialize(server, port) @server = server @port = port end
Public Instance Methods
account_exists?(sender_account, account)
click to toggle source
# File lib/email_probe/smtp_connection.rb, line 15 def account_exists?(sender_account, account) connection = start_connection(account) connection.mailfrom(sender_account.address) begin account_status = connection.rcptto(account.address).status.to_i rescue Net::SMTPFatalError => e raise e unless e.message =~ /^550/ account_status = 550 end connection.finish account_status == Status::SUCCESS end
Private Instance Methods
start_connection(account)
click to toggle source
# File lib/email_probe/smtp_connection.rb, line 35 def start_connection(account) Net::SMTP.start(server, port, account.domain) end