Skip to content

Commit 359e2dd

Browse files
Updated to call MailboxValidator v2 APIs
1 parent fab473b commit 359e2dd

File tree

4 files changed

+109
-99
lines changed

4 files changed

+109
-99
lines changed

LICENSE.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 MailboxValidator.com
3+
Copyright (c) 2023 MailboxValidator.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ Performs email validation on the supplied email address.
4444
|-----------|------------|
4545
| email_address | The input email address. |
4646
| domain | The domain of the email address. |
47-
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False |
48-
| is_syntax | Whether the email address is syntactically correct. Return values: True, False |
49-
| is_domain | Whether the email address has a valid MX record in its DNS entries. Return values: True, False, -   (- means not applicable) |
50-
| is_smtp | Whether the mail servers specified in the MX records are responding to connections. Return values: True, False, -   (- means not applicable) |
51-
| is_verified | Whether the mail server confirms that the email address actually exist. Return values: True, False, -   (- means not applicable) |
52-
| is_server_down | Whether the mail server is currently down or unresponsive. Return values: True, False, -   (- means not applicable) |
53-
| is_greylisted | Whether the mail server employs greylisting where an email has to be sent a second time at a later time. Return values: True, False, -   (- means not applicable) |
54-
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False, -   (- means not applicable) |
55-
| is_suppressed | Whether the email address is in our blacklist. Return values: True, False, -   (- means not applicable) |
56-
| is_role | Whether the email address is a role-based email address like [email protected] or [email protected]. Return values: True, False, -   (- means not applicable) |
57-
| is_high_risk | Whether the email address contains high risk keywords. Return values: True, False, -   (- means not applicable) |
58-
| is_catchall | Whether the email address is a catch-all address. Return values: True, False, Unknown, -   (- means not applicable) |
47+
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: true, false |
48+
| is_syntax | Whether the email address is syntactically correct. Return values: true, false |
49+
| is_domain | Whether the email address has a valid MX record in its DNS entries. Return values: true, false, null   (null means not applicable) |
50+
| is_smtp | Whether the mail servers specified in the MX records are responding to connections. Return values: true, false, null   (null means not applicable) |
51+
| is_verified | Whether the mail server confirms that the email address actually exist. Return values: true, false, null   (null means not applicable) |
52+
| is_server_down | Whether the mail server is currently down or unresponsive. Return values: true, false, null   (null means not applicable) |
53+
| is_greylisted | Whether the mail server employs greylisting where an email has to be sent a second time at a later time. Return values: true, false, null   (null means not applicable) |
54+
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: true, false, null   (null means not applicable) |
55+
| is_suppressed | Whether the email address is in our blacklist. Return values: true, false, null   (null means not applicable) |
56+
| is_role | Whether the email address is a role-based email address like [email protected] or [email protected]. Return values: true, false, null   (null means not applicable) |
57+
| is_high_risk | Whether the email address contains high risk keywords. Return values: true, false, null   (null means not applicable) |
58+
| is_catchall | Whether the email address is a catch-all address. Return values: true, false, Unknown, null   (null means not applicable) |
5959
| mailboxvalidator_score | Email address reputation score. Score > 0.70 means good; score > 0.40 means fair; score <= 0.40 means poor. |
6060
| time_taken | The time taken to get the results in seconds. |
61-
| status | Whether our system think the email address is valid based on all the previous fields. Return values: True, False |
61+
| status | Whether our system think the email address is valid based on all the previous fields. Return values: true, false |
6262
| credits_available | The number of credits left to perform validations. |
6363
| error_code | The error code if there is any error. See error table in the below section. |
6464
| error_message | The error message if there is any error. See error table in the below section. |
@@ -72,7 +72,7 @@ Check if the supplied email address is from a disposable email provider.
7272
| Field Name | Description |
7373
|-----------|------------|
7474
| email_address | The input email address. |
75-
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False |
75+
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: true, false |
7676
| credits_available | The number of credits left to perform validations. |
7777
| error_code | The error code if there is any error. See error table in the below section. |
7878
| error_message | The error message if there is any error. See error table in the below section. |
@@ -86,7 +86,7 @@ Check if the supplied email address is from a free email provider.
8686
| Field Name | Description |
8787
|-----------|------------|
8888
| email_address | The input email address. |
89-
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False |
89+
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: true, false |
9090
| credits_available | The number of credits left to perform validations. |
9191
| error_code | The error code if there is any error. See error table in the below section. |
9292
| error_message | The error message if there is any error. See error table below. |
@@ -113,7 +113,7 @@ public class Main
113113
MBVResult rec = mbv.ValidateEmail("[email protected]");
114114
// System.out.println(rec); // for dumping out all result fields
115115

116-
if (rec.getErrorMessage().equals("")) {
116+
if (rec.getErrorMessage() == null) {
117117
System.out.println("email_address: " + rec.getEmailAddress());
118118
System.out.println("domain: " + rec.getDomain());
119119
System.out.println("is_free: " + rec.getIsFree());
@@ -166,7 +166,7 @@ public class Main
166166
MBVResult rec = mbv.DisposableEmail("[email protected]");
167167
// System.out.println(rec); // for dumping out all result fields
168168

169-
if (rec.getErrorMessage().equals("")) {
169+
if (rec.getErrorMessage() == null) {
170170
System.out.println("email_address: " + rec.getEmailAddress());
171171
System.out.println("is_disposable: " + rec.getIsDisposable());
172172
System.out.println("credits_available: " + rec.getCreditsAvailable());
@@ -204,7 +204,7 @@ public class Main
204204
MBVResult rec = mbv.FreeEmail("[email protected]");
205205
// System.out.println(rec); // for dumping out all result fields
206206

207-
if (rec.getErrorMessage().equals("")) {
207+
if (rec.getErrorMessage() == null) {
208208
System.out.println("email_address: " + rec.getEmailAddress());
209209
System.out.println("is_free: " + rec.getIsFree());
210210
System.out.println("credits_available: " + rec.getCreditsAvailable());
@@ -229,14 +229,15 @@ Errors
229229

230230
| error_code | error_message |
231231
| ---------- | ------------- |
232-
| 100 | Missing parameter. |
233-
| 101 | API key not found. |
234-
| 102 | API key disabled. |
235-
| 103 | API key expired. |
236-
| 104 | Insufficient credits. |
237-
| 105 | Unknown error. |
232+
| 10000 | Missing parameter. |
233+
| 10001 | API key not found. |
234+
| 10002 | API key disabled. |
235+
| 10003 | API key expired. |
236+
| 10004 | Insufficient credits. |
237+
| 10005 | Unknown error. |
238+
| 10006 | Invalid email syntax. |
238239

239240
Copyright
240241
=========
241242

242-
Copyright (C) 2018-2020 by MailboxValidator.com, [email protected]
243+
Copyright (C) 2023 by MailboxValidator.com, [email protected]

src/com/mailboxvalidator/MBVResult.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class MBVResult {
2525
int credits_available;
2626
String error_code;
2727
String error_message;
28-
String version = "1.1.0";
28+
String version = "2.0.0";
2929
MBVResult(String email) {
3030
email_address = email;
3131
}
@@ -41,67 +41,67 @@ public class MBVResult {
4141
public String getDomain() { return domain; }
4242
/**
4343
* This method to get whether the email address is from a free email provider.
44-
* @return "True", "False" or "-" if not applicable.
44+
* @return "true", "false" or "null" if not applicable.
4545
*/
4646
public String getIsFree() { return is_free; }
4747
/**
4848
* This method to get whether the email address is syntactically correct.
49-
* @return "True", "False" or "-" if not applicable.
49+
* @return "true", "false" or "null" if not applicable.
5050
*/
5151
public String getIsSyntax() { return is_syntax; }
5252
/**
5353
* This method to get whether the email domain has a valid MX record in the DNS entries.
54-
* @return "True", "False" or "-" if not applicable.
54+
* @return "true", "false" or "null" if not applicable.
5555
*/
5656
public String getIsDomain() { return is_domain; }
5757
/**
5858
* This method to get whether the mail server is responding to connection.
59-
* @return "True", "False" or "-" if not applicable.
59+
* @return "true", "false" or "null" if not applicable.
6060
*/
6161
public String getIsSMTP() { return is_smtp; }
6262
/**
6363
* This method to get whether the mail server confirms that the email address actually exists.
64-
* @return "True", "False" or "-" if not applicable.
64+
* @return "true", "false" or "null" if not applicable.
6565
*/
6666
public String getIsVerified() { return is_verified; }
6767
/**
6868
* This method to get whether the mail server is currently down or unresponsive.
69-
* @return "True", "False" or "-" if not applicable.
69+
* @return "true", "false" or "null" if not applicable.
7070
*/
7171
public String getIsServerDown() { return is_server_down; }
7272
/**
7373
* This method to get whether the mail server employs greylisting.
74-
* @return "True", "False" or "-" if not applicable.
74+
* @return "true", "false" or "null" if not applicable.
7575
*/
7676
public String getIsGreylisted() { return is_greylisted; }
7777
/**
7878
* This method to get whether the email address is from a disposable email provider.
79-
* @return "True", "False" or "-" if not applicable.
79+
* @return "true", "false" or "null" if not applicable.
8080
*/
8181
public String getIsDisposable() { return is_disposable; }
8282
/**
8383
* This method to get whether the email address is in our blacklist.
84-
* @return "True", "False" or "-" if not applicable.
84+
* @return "true", "false" or "null" if not applicable.
8585
*/
8686
public String getIsSuppressed() { return is_suppressed; }
8787
/**
8888
* This method to get whether the email address is a role-based email address.
89-
* @return "True", "False" or "-" if not applicable.
89+
* @return "true", "false" or "null" if not applicable.
9090
*/
9191
public String getIsRole() { return is_role; }
9292
/**
9393
* This method to get whether the email address contains high risk keywords.
94-
* @return "True", "False" or "-" if not applicable.
94+
* @return "true", "false" or "null" if not applicable.
9595
*/
9696
public String getIsHighRisk() { return is_high_risk; }
9797
/**
9898
* This method to get whether the email address is a catch-all address.
99-
* @return "True", "False" or "-" if not applicable.
99+
* @return "true", "false" or "null" if not applicable.
100100
*/
101101
public String getIsCatchall() { return is_catchall; }
102102
/**
103103
* This method to get the email reputation score.
104-
* @return the email reputation score; score > 0.70 means good; score > 0.40 means fair; score 0.40 means poor.
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.
105105
*/
106106
public float getMailboxValidatorScore() { return mailboxvalidator_score; }
107107
/**
@@ -111,7 +111,7 @@ public class MBVResult {
111111
public float getTimeTaken() { return time_taken; }
112112
/**
113113
* This method to get whether our system think the email address is valid based on the various result fields.
114-
* @return "True", "False" or "-" if not applicable.
114+
* @return "true", "false" or "null" if not applicable.
115115
*/
116116
public String getStatus() { return status; }
117117
/**

0 commit comments

Comments
 (0)