lib/cogi_email/checker.rb
##
# Returns server object for given email address or throws exception
# Object returned isn't yet connected. It has internally a list of
# real mail servers got from MX dns lookup
#
# Reference:
#   https://github.com/kamilc/email_verifier/blob/master/lib/email_verifier/checker.rb
Returns server object for given email address or throws exception
Object returned isn't yet connected. It has internally a list of
real mail servers got from MX dns lookup


Returns server object for given email address or throws exception Object returned isn ' t yet connected . It has internally a list of real mail servers got from MX dns lookup
def connect
      list_mxs
      raise CogiEmail::NoMailServerException.new("No mail server for #{@email}") if @servers.empty?
      begin
        server = next_server
        raise CogiEmail::OutOfMailServersException.new("Unable to connect to any one of mail servers for #{@email}") if server.nil?
        @smtp = Net::SMTP.start server[:address], 25, @user_domain
        return true
      rescue CogiEmail::OutOfMailServersException => e
        raise CogiEmail::OutOfMailServersException, e.message
      rescue => e
        retry
      end
    end
def connect list_mxs raise CogiEmail :: NoMailServerException . new ( "No mail server for #{@email}" ) if @servers . empty? begin server = next_server raise CogiEmail :: OutOfMailServersException . new ( "Unable to connect to any one of mail servers for #{@email}" ) if server . nil? @smtp = Net :: SMTP . start server [ :address ] , 25 , @user_domain return true rescue CogiEmail :: OutOfMailServersException => e raise CogiEmail :: OutOfMailServersException , e . message rescue => e retry end end
Returns server object for given email address or throws exception
Object returned isn't yet connected.
Returns server object for given email address or throws exception Object returned isn ' t yet connected .