· 7 years ago · May 02, 2018, 07:36 PM
1Sub SpamInator()
2
3'Variables declaration
4'This array below is a list of all most popular domain names for emails in France, UK and the US
5
6Dim listDomains As Variant
7
8listDomains = Array("yahoo.com", "yahoo.co.uk", "hotmail.com", "hotmail.co.uk", "msn.com", "gmail.com", "gmail.co.uk", "googlemail.com", "comcast.com", _
9 "sbcglobal.com", "bellsouth.com", "verizon.com", "earthlink.com", "orange.fr", "cox.com", "rediffmail.com", _
10"caramail.com", "btinternet.co.uk", "btinternet.com", "charter.com", "shaw.com", "ntlworld.com", "aol.com", "aol.co.uk", "aol.fr", "comcast.com", _
11"facebook.com", "gmx.com", "me.com", "mac.com", "live.com", "live.fr", "fastmail", "games", "hush", "hushmail", _
12"outlook.com", "outlook.co.uk", "outlook.fr", "rocketmail.com", "rocketmail.fr", "rocketmail.co.uk", "ymail.com", "zoho.ru", "zoho.com", "zoho.co.uk", _
13 "yandex.ru", "virginmedia.com", "virginmedia.co.uk", "virginmedia.fr", _
14 "blueyonder.com", "freeserver.com", _
15"tiscali.co.uk", "talktalk.co.uk", "sky.co.uk", "o2.co.uk", "ntlworld.co.uk", _
16"wanadoo.com", "wanadoo.co.uk", "wanadoo.fr", "btinternet.co.uk", "virgin.com", "t-online.com", "laposte.fr", _
17"libero.it", "vrigilio.it", "alice.it", "rambler.de", "tvcable.de", "telenet.de", "fibertel.de")
18
19Dim LastRow1 As Long
20Dim index1 As Variant
21Dim cellValue As String
22Dim rightPart As String
23Dim refCell As String
24Dim j As Long
25Dim check1 As Boolean
26
27
28
29LastRow1 = Cells(Rows.Count, "A").End(xlUp).Row
30
31
32
33For Each index1 In Range("A2:A" & LastRow1)
34
35check1 = False
36cellValue = index1.Value
37
38If Not IsNull(InStr(cellValue, "@")) Then
39refCell = Right(cellValue, Len(cellValue) - (InStr(cellValue, "@")))
40
41
42For j = LBound(listDomains) To UBound(listDomains)
43
44If listDomains(j) = refCell Then
45
46check1 = True
47
48
49End If
50
51Next j
52
53If check1 = True Then
54
55index1.Offset(0, 1) = "Domain name recognised"
56
57Else
58
59index1.Offset(0, 1) = "Domain name not recognised"
60
61End If
62
63End If
64
65
66
67Next index1
68
69
70
71
72
73
74
75
76
77
78End Sub