email address

require 'resolv'
def valid_email_host?(email)
  hostname = email[(email =~ /@/)+1..email.length]
  valid = true
  begin
    Resolv::DNS.new.getresource(hostname, Resolv::DNS::Resource::IN::MX)
  rescue Resolv::ResolvError
    valid = false
  end
  return valid
end

valid_email_host?('j@l.m')       # => false
valid_email_host?('joe@oreilly.com')          # => true

Writing teacher: n.pasandeh@unswglobal.unsw.edu.au

main teacher: Angela, A.Snelgrove@unswglobal.unsw.au

Listen to & Presentation teacher:John, j.dsouza@unsw.edu.au

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图