Module: EmailHomepage

Defined in:
lib/email_homepage.rb,
lib/email_homepage/version.rb

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.get(email_address) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/email_homepage.rb', line 4

def self.get email_address
  return nil unless email_address.match /^.+@.+$/
  email_address.downcase!
  if (email_address.match /@qq.com/) || (email_address.match /@foxmail.com/)
    return "http://mail.qq.com"
  elsif email_address.match /@163.com/
    return "http://mail.163.com"
  elsif email_address.match /@vip.163.com/
    return "http://vip.163.com"
  elsif email_address.match /@126.com/
    return "http://mail.126.com"
  elsif email_address.match /@gmail.com/
    return "http://mail.google.com"
  elsif email_address.match /@sohu.com/
    return "http://mail.sohu.com"
  elsif (email_address.match /@sina.com.cn/) || (email_address.match /@sina.com/)
    return "http://mail.sina.com.cn"
  elsif email_address.match /@vip.sina.com/
    return "http://vip.sina.com"
  elsif email_address.match /@aliyun.com/
    return "https://mail.aliyun.com/"
  elsif email_address.match /@yahoo.com/
    return "http://mail.yahoo.com"
  elsif email_address.match /@tom.com/
    return "http://tom.com"
  elsif email_address.match /@yeah.net/
    return "http://yeah.net"
  elsif email_address.match /@21cn.com/
    return "http://mail.21cn.com"
  elsif (email_address.match /@hotmail.com/) || (email_address.match /@outlook.com/) || (email_address.match /@live.com/)
    return "http://outlook.office.com"
  elsif email_address.match /@sogou.com/
    return "http://mail.sogou.com"
  elsif email_address.match /@188.com/
    return "http://www.188.com"
  elsif email_address.match /@139.com/
    return "http://mail.10086.cn/"
  elsif email_address.match /@189.cn/
    return "http://webmail30.189.cn/w2/"
  elsif email_address.match /@zoho.com/
    return "https://www.zoho.com.cn/mail/"
  else
    domain_name = email_address.split(/@/).last
    host_name = `host #{domain_name} | grep mail | awk 'NR==1{print $7}'`
    if host_name.match /qq.com/
      return "http://exmail.qq.com/login"
    elsif (host_name.match /163.com/) || (host_name.match /netease.com/)
      return "http://ym.163.com/"
    elsif (host_name.match /google.com/) || (host_name.match /googlemail.com/)
      return "https://www.google.com/intl/zh-CN/mail/help/work.html"
    elsif (host_name.match /outlook.com/) || (email_address.match /@hotmail.com/) || (email_address.match /@live.com/)
      return "http://outlook.office.com"
    elsif host_name.match /aliyun.com/
      return "https://mail.aliyun.com/"
    elsif host_name.match /sina.net/
      return "http://mail.sina.net/"
    elsif host_name.match /zoho.com/
      return "https://www.zoho.com.cn/mail/"
    elsif host_name.match /sohu.net/
      return "http://mail.sohu.net/"
    elsif host_name.match /21cn.com/
      return "http://exmail.189.cn/"
    else
      return nil
    end
  end
end