Skip to content

Commit 73ac646

Browse files
Support new fields in MailboxValidator API
1 parent 4072ca6 commit 73ac646

File tree

2 files changed

+561
-521
lines changed

2 files changed

+561
-521
lines changed
Lines changed: 195 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,167 +1,195 @@
1-
/**
2-
* MBVResult.java
3-
*/
4-
5-
package com.mailboxvalidator;
6-
7-
public class MBVResult {
8-
String email_address;
9-
String domain;
10-
String is_free;
11-
String is_syntax;
12-
String is_domain;
13-
String is_smtp;
14-
String is_verified;
15-
String is_server_down;
16-
String is_greylisted;
17-
String is_disposable;
18-
String is_suppressed;
19-
String is_role;
20-
String is_high_risk;
21-
String is_catchall;
22-
float mailboxvalidator_score;
23-
float time_taken;
24-
String status;
25-
int credits_available;
26-
String error_code;
27-
String error_message;
28-
String version = "2.0.0";
29-
MBVResult(String email) {
30-
email_address = email;
31-
}
32-
/**
33-
* This method to get the email address being validated.
34-
* @return the email address being validated.
35-
*/
36-
public String getEmailAddress() { return email_address; }
37-
/**
38-
* This method to get the domain name of the email address.
39-
* @return the domain name.
40-
*/
41-
public String getDomain() { return domain; }
42-
/**
43-
* This method to get whether the email address is from a free email provider.
44-
* @return "true", "false" or "null" if not applicable.
45-
*/
46-
public String getIsFree() { return is_free; }
47-
/**
48-
* This method to get whether the email address is syntactically correct.
49-
* @return "true", "false" or "null" if not applicable.
50-
*/
51-
public String getIsSyntax() { return is_syntax; }
52-
/**
53-
* This method to get whether the email domain has a valid MX record in the DNS entries.
54-
* @return "true", "false" or "null" if not applicable.
55-
*/
56-
public String getIsDomain() { return is_domain; }
57-
/**
58-
* This method to get whether the mail server is responding to connection.
59-
* @return "true", "false" or "null" if not applicable.
60-
*/
61-
public String getIsSMTP() { return is_smtp; }
62-
/**
63-
* This method to get whether the mail server confirms that the email address actually exists.
64-
* @return "true", "false" or "null" if not applicable.
65-
*/
66-
public String getIsVerified() { return is_verified; }
67-
/**
68-
* This method to get whether the mail server is currently down or unresponsive.
69-
* @return "true", "false" or "null" if not applicable.
70-
*/
71-
public String getIsServerDown() { return is_server_down; }
72-
/**
73-
* This method to get whether the mail server employs greylisting.
74-
* @return "true", "false" or "null" if not applicable.
75-
*/
76-
public String getIsGreylisted() { return is_greylisted; }
77-
/**
78-
* This method to get whether the email address is from a disposable email provider.
79-
* @return "true", "false" or "null" if not applicable.
80-
*/
81-
public String getIsDisposable() { return is_disposable; }
82-
/**
83-
* This method to get whether the email address is in our blacklist.
84-
* @return "true", "false" or "null" if not applicable.
85-
*/
86-
public String getIsSuppressed() { return is_suppressed; }
87-
/**
88-
* This method to get whether the email address is a role-based email address.
89-
* @return "true", "false" or "null" if not applicable.
90-
*/
91-
public String getIsRole() { return is_role; }
92-
/**
93-
* This method to get whether the email address contains high risk keywords.
94-
* @return "true", "false" or "null" if not applicable.
95-
*/
96-
public String getIsHighRisk() { return is_high_risk; }
97-
/**
98-
* This method to get whether the email address is a catch-all address.
99-
* @return "true", "false" or "null" if not applicable.
100-
*/
101-
public String getIsCatchall() { return is_catchall; }
102-
/**
103-
* This method to get the email reputation score.
104-
* @return the email reputation score; score greater than 0.70 means good; score greater than 0.40 means fair; score less than or equal to 0.40 means poor.
105-
*/
106-
public float getMailboxValidatorScore() { return mailboxvalidator_score; }
107-
/**
108-
* This method to get the execution time of the API in seconds.
109-
* @return the time taken for the API execution in seconds.
110-
*/
111-
public float getTimeTaken() { return time_taken; }
112-
/**
113-
* This method to get whether our system think the email address is valid based on the various result fields.
114-
* @return "true", "false" or "null" if not applicable.
115-
*/
116-
public String getStatus() { return status; }
117-
/**
118-
* This method to get the number of remaining query credits.
119-
* @return the number of remaining query credits.
120-
*/
121-
public int getCreditsAvailable() { return credits_available; }
122-
/**
123-
* This method to get the error code.
124-
* @return the error code if an error occurred or blank if none.
125-
*/
126-
public String getErrorCode() { return error_code; }
127-
/**
128-
* This method to get the error message.
129-
* @return the error message if an error occurred or blank if none.
130-
*/
131-
public String getErrorMessage() { return error_message; }
132-
/**
133-
* This method to get component version.
134-
* @return the component version.
135-
*/
136-
public String getVersion() { return version; }
137-
/**
138-
* This method to return all the fields.
139-
* @return the result in a formatted string.
140-
*/
141-
public String toString() {
142-
String NL = System.getProperty("line.separator");
143-
StringBuffer buf = new StringBuffer("MBVResult:"+NL);
144-
buf.append("\temail_address = "+email_address+NL);
145-
buf.append("\tdomain = "+domain+NL);
146-
buf.append("\tis_free = "+is_free+NL);
147-
buf.append("\tis_syntax = "+is_syntax+NL);
148-
buf.append("\tis_domain = "+is_domain+NL);
149-
buf.append("\tis_smtp = "+is_smtp+NL);
150-
buf.append("\tis_verified = "+is_verified+NL);
151-
buf.append("\tis_server_down = "+is_server_down+NL);
152-
buf.append("\tis_greylisted = "+is_greylisted+NL);
153-
buf.append("\tis_disposable = "+is_disposable+NL);
154-
buf.append("\tis_suppressed = "+is_suppressed+NL);
155-
buf.append("\tis_role = "+is_role+NL);
156-
buf.append("\tis_high_risk = "+is_high_risk+NL);
157-
buf.append("\tis_catchall = "+is_catchall+NL);
158-
buf.append("\tmailboxvalidator_score = "+mailboxvalidator_score+NL);
159-
buf.append("\ttime_taken = "+time_taken+NL);
160-
buf.append("\tstatus = "+status+NL);
161-
buf.append("\tcredits_available = "+credits_available+NL);
162-
buf.append("\terror_code = "+error_code+NL);
163-
buf.append("\terror_message = "+error_message+NL);
164-
buf.append("\tversion = "+version+NL);
165-
return buf.toString();
166-
}
167-
}
1+
/**
2+
* MBVResult.java
3+
*/
4+
5+
package com.mailboxvalidator;
6+
7+
public class MBVResult {
8+
String email_address;
9+
String base_email_address;
10+
String domain;
11+
String is_free;
12+
String is_syntax;
13+
String is_domain;
14+
String is_smtp;
15+
String is_verified;
16+
String is_server_down;
17+
String is_greylisted;
18+
String is_disposable;
19+
String is_suppressed;
20+
String is_role;
21+
String is_high_risk;
22+
String is_catchall;
23+
String is_dmarc_enforced;
24+
String is_strict_spf;
25+
String website_exist;
26+
float mailboxvalidator_score;
27+
float time_taken;
28+
String status;
29+
int credits_available;
30+
String error_code;
31+
String error_message;
32+
String version = "2.1.0";
33+
MBVResult(String email) {
34+
email_address = email;
35+
}
36+
/**
37+
* This method to get the email address being validated.
38+
* @return the email address being validated.
39+
*/
40+
public String getEmailAddress() { return email_address; }
41+
/**
42+
* This method to get the base email address of the email address being validated.
43+
* @return the base email address of the email address being validated.
44+
*/
45+
public String getBaseEmailAddress() { return base_email_address; }
46+
/**
47+
* This method to get the domain name of the email address.
48+
* @return the domain name.
49+
*/
50+
public String getDomain() { return domain; }
51+
/**
52+
* This method to get whether the email address is from a free email provider.
53+
* @return "true", "false" or "null" if not applicable.
54+
*/
55+
public String getIsFree() { return is_free; }
56+
/**
57+
* This method to get whether the email address is syntactically correct.
58+
* @return "true", "false" or "null" if not applicable.
59+
*/
60+
public String getIsSyntax() { return is_syntax; }
61+
/**
62+
* This method to get whether the email domain has a valid MX record in the DNS entries.
63+
* @return "true", "false" or "null" if not applicable.
64+
*/
65+
public String getIsDomain() { return is_domain; }
66+
/**
67+
* This method to get whether the mail server is responding to connection.
68+
* @return "true", "false" or "null" if not applicable.
69+
*/
70+
public String getIsSMTP() { return is_smtp; }
71+
/**
72+
* This method to get whether the mail server confirms that the email address actually exists.
73+
* @return "true", "false" or "null" if not applicable.
74+
*/
75+
public String getIsVerified() { return is_verified; }
76+
/**
77+
* This method to get whether the mail server is currently down or unresponsive.
78+
* @return "true", "false" or "null" if not applicable.
79+
*/
80+
public String getIsServerDown() { return is_server_down; }
81+
/**
82+
* This method to get whether the mail server employs greylisting.
83+
* @return "true", "false" or "null" if not applicable.
84+
*/
85+
public String getIsGreylisted() { return is_greylisted; }
86+
/**
87+
* This method to get whether the email address is from a disposable email provider.
88+
* @return "true", "false" or "null" if not applicable.
89+
*/
90+
public String getIsDisposable() { return is_disposable; }
91+
/**
92+
* This method to get whether the email address is in our blacklist.
93+
* @return "true", "false" or "null" if not applicable.
94+
*/
95+
public String getIsSuppressed() { return is_suppressed; }
96+
/**
97+
* This method to get whether the email address is a role-based email address.
98+
* @return "true", "false" or "null" if not applicable.
99+
*/
100+
public String getIsRole() { return is_role; }
101+
/**
102+
* This method to get whether the email address contains high risk keywords.
103+
* @return "true", "false" or "null" if not applicable.
104+
*/
105+
public String getIsHighRisk() { return is_high_risk; }
106+
/**
107+
* This method to get whether the email address is a catch-all address.
108+
* @return "true", "false" or "null" if not applicable.
109+
*/
110+
public String getIsCatchall() { return is_catchall; }
111+
/**
112+
* This method to get whether the email domain is enforcing DMARC.
113+
* @return "true", "false" or "null" if not applicable.
114+
*/
115+
public String getIsDMARCEnforced() { return is_dmarc_enforced; }
116+
/**
117+
* This method to get whether the email domain is using strict SPF.
118+
* @return "true", "false" or "null" if not applicable.
119+
*/
120+
public String getIsStrictSPF() { return is_strict_spf; }
121+
/**
122+
* This method to get whether the email domain is a reachable website.
123+
* @return "true", "false" or "null" if not applicable.
124+
*/
125+
public String getWebsiteExist() { return website_exist; }
126+
/**
127+
* This method to get the email reputation score.
128+
* @return the email reputation score; score greater than 0.70 means good; score greater than 0.40 means fair; score less than or equal to 0.40 means poor.
129+
*/
130+
public float getMailboxValidatorScore() { return mailboxvalidator_score; }
131+
/**
132+
* This method to get the execution time of the API in seconds.
133+
* @return the time taken for the API execution in seconds.
134+
*/
135+
public float getTimeTaken() { return time_taken; }
136+
/**
137+
* This method to get whether our system think the email address is valid based on the various result fields.
138+
* @return "true", "false" or "null" if not applicable.
139+
*/
140+
public String getStatus() { return status; }
141+
/**
142+
* This method to get the number of remaining query credits.
143+
* @return the number of remaining query credits.
144+
*/
145+
public int getCreditsAvailable() { return credits_available; }
146+
/**
147+
* This method to get the error code.
148+
* @return the error code if an error occurred or blank if none.
149+
*/
150+
public String getErrorCode() { return error_code; }
151+
/**
152+
* This method to get the error message.
153+
* @return the error message if an error occurred or blank if none.
154+
*/
155+
public String getErrorMessage() { return error_message; }
156+
/**
157+
* This method to get component version.
158+
* @return the component version.
159+
*/
160+
public String getVersion() { return version; }
161+
/**
162+
* This method to return all the fields.
163+
* @return the result in a formatted string.
164+
*/
165+
public String toString() {
166+
String NL = System.getProperty("line.separator");
167+
StringBuffer buf = new StringBuffer("MBVResult:"+NL);
168+
buf.append("\temail_address = "+email_address+NL);
169+
buf.append("\tbase_email_address = "+base_email_address+NL);
170+
buf.append("\tdomain = "+domain+NL);
171+
buf.append("\tis_free = "+is_free+NL);
172+
buf.append("\tis_syntax = "+is_syntax+NL);
173+
buf.append("\tis_domain = "+is_domain+NL);
174+
buf.append("\tis_smtp = "+is_smtp+NL);
175+
buf.append("\tis_verified = "+is_verified+NL);
176+
buf.append("\tis_server_down = "+is_server_down+NL);
177+
buf.append("\tis_greylisted = "+is_greylisted+NL);
178+
buf.append("\tis_disposable = "+is_disposable+NL);
179+
buf.append("\tis_suppressed = "+is_suppressed+NL);
180+
buf.append("\tis_role = "+is_role+NL);
181+
buf.append("\tis_high_risk = "+is_high_risk+NL);
182+
buf.append("\tis_catchall = "+is_catchall+NL);
183+
buf.append("\tis_dmarc_enforced = "+is_dmarc_enforced+NL);
184+
buf.append("\tis_strict_spf = "+is_strict_spf+NL);
185+
buf.append("\twebsite_exist = "+website_exist+NL);
186+
buf.append("\tmailboxvalidator_score = "+mailboxvalidator_score+NL);
187+
buf.append("\ttime_taken = "+time_taken+NL);
188+
buf.append("\tstatus = "+status+NL);
189+
buf.append("\tcredits_available = "+credits_available+NL);
190+
buf.append("\terror_code = "+error_code+NL);
191+
buf.append("\terror_message = "+error_message+NL);
192+
buf.append("\tversion = "+version+NL);
193+
return buf.toString();
194+
}
195+
}

0 commit comments

Comments
 (0)