Skip to content

Commit 5165069

Browse files
Added more details on usage and results
1 parent 2b2cbf3 commit 5165069

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

README.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,164 @@ An API key is required for this module to function.
2323

2424
Go to http://www.mailboxvalidator.com/plans#api to sign up for a FREE API plan and you'll be given an API key.
2525

26+
Usage
27+
=====
28+
29+
```ruby
30+
require "mailboxvalidator_ruby"
31+
32+
apikey = "MY_API_KEY"
33+
34+
35+
mbv = MailboxValidator::MBV.new()
36+
mbv.apikey = apikey
37+
mbv.query_single(email)
38+
39+
if mbv.error != nil
40+
puts "Error: #{mbv.error}"
41+
elsif mbv.result != nil
42+
puts "email_address: #{mbv.result.email_address}"
43+
puts "domain: #{mbv.result.domain}"
44+
puts "is_free: #{mbv.result.is_free}"
45+
puts "is_syntax: #{mbv.result.is_syntax}"
46+
puts "is_domain: #{mbv.result.is_domain}"
47+
puts "is_smtp: #{mbv.result.is_smtp}"
48+
puts "is_verified: #{mbv.result.is_verified}"
49+
puts "is_server_down: #{mbv.result.is_server_down}"
50+
puts "is_greylisted: #{mbv.result.is_greylisted}"
51+
puts "is_disposable: #{mbv.result.is_disposable}"
52+
puts "is_suppressed: #{mbv.result.is_suppressed}"
53+
puts "is_role: #{mbv.result.is_role}"
54+
puts "is_high_risk: #{mbv.result.is_high_risk}"
55+
puts "is_catchall: #{mbv.result.is_catchall}"
56+
puts "mailboxvalidator_score: #{mbv.result.mailboxvalidator_score}"
57+
puts "time_taken: #{mbv.result.time_taken}"
58+
puts "status: #{mbv.result.status}"
59+
puts "credits_available: #{mbv.result.credits_available}"
60+
puts "error_code: #{mbv.result.error_code}"
61+
puts "error_message: #{mbv.result.error_message}"
62+
end
63+
```
64+
65+
Functions
66+
=========
67+
68+
### new
69+
70+
Creates a new instance of the MailboxValidator object.
71+
72+
### query_single
73+
74+
Performs email validation on the supplied email address.
75+
76+
Result Fields
77+
=============
78+
79+
### email_address
80+
81+
The input email address.
82+
83+
### domain
84+
85+
The domain of the email address.
86+
87+
### is_free
88+
89+
Whether the email address is from a free email provider like Gmail or Hotmail.
90+
Return values: True, False
91+
92+
### is_syntax
93+
94+
Whether the email address is syntactically correct.
95+
Return values: True, False
96+
97+
### is_domain
98+
99+
Whether the email address has a valid MX record in its DNS entries.
100+
Return values: True, False, - (- means not applicable)
101+
102+
### is_smtp
103+
104+
Whether the mail servers specified in the MX records are responding to connections.
105+
Return values: True, False, - (- means not applicable)
106+
107+
### is_verified
108+
109+
Whether the mail server confirms that the email address actually exist.
110+
Return values: True, False, - (- means not applicable)
111+
112+
### is_server_down
113+
114+
Whether the mail server is currently down or unresponsive.
115+
Return values: True, False, - (- means not applicable)
116+
117+
### is_greylisted
118+
119+
Whether the mail server employs greylisting where an email has to be sent a second time at a later time.
120+
Return values: True, False, - (- means not applicable)
121+
122+
### is_disposable
123+
124+
Whether the email address is a temporary one from a disposable email provider.
125+
Return values: True, False, - (- means not applicable)
126+
127+
### is_suppressed
128+
129+
Whether the email address is in our blacklist.
130+
Return values: True, False, - (- means not applicable)
131+
132+
### is_role
133+
134+
Whether the email address is a role-based email address like [email protected] or [email protected].
135+
Return values: True, False, - (- means not applicable)
136+
137+
### is_high_risk
138+
139+
Whether the email address contains high risk keywords.
140+
Return values: True, False, - (- means not applicable)
141+
142+
### is_catchall
143+
144+
Whether the email address is a catch-all address.
145+
Return values: True, False, Unknown, - (- means not applicable)
146+
147+
### mailboxvalidator_score
148+
149+
Email address reputation score. Score > 0.70 means good; score > 0.40 means fair; score <= 0.40 means poor.
150+
151+
### time_taken
152+
153+
The time taken to get the results in seconds.
154+
155+
### status
156+
157+
Whether our system think the email address is valid based on all the previous fields.
158+
Return values: True, False
159+
160+
### credits_available
161+
162+
The number of credits left to perform validations.
163+
164+
### error_code
165+
166+
The error code if there is any error. See error table below.
167+
168+
### error_message
169+
170+
The error message if there is any error. See error table below.
171+
172+
Errors
173+
======
174+
175+
| error_code | error_message |
176+
| ---------- | ------------- |
177+
| 100 | Missing parameter. |
178+
| 101 | API key not found. |
179+
| 102 | API key disabled. |
180+
| 103 | API key expired. |
181+
| 104 | Insufficient credits. |
182+
| 105 | Unknown error. |
183+
26184
Copyright
27185
=========
28186

0 commit comments

Comments
 (0)