|
| 1 | +MailboxValidator Python Module |
| 2 | +============================== |
| 3 | + |
| 4 | +This Python module provides an easy way to call the MailboxValidator API which validates if an email address is a valid one. |
| 5 | + |
| 6 | +This module can be used in many types of projects such as: |
| 7 | + |
| 8 | + - validating a user's email during sign up |
| 9 | + - cleaning your mailing list prior to an email marketing campaign |
| 10 | + - a form of fraud check |
| 11 | + |
| 12 | + |
| 13 | +Installation |
| 14 | +============ |
| 15 | + |
| 16 | +To install this module type the following: |
| 17 | + |
| 18 | + pip install MailboxValidator |
| 19 | + |
| 20 | + |
| 21 | +Dependencies |
| 22 | +============ |
| 23 | + |
| 24 | +An API key is required for this module to function. |
| 25 | + |
| 26 | +Go to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key. |
| 27 | + |
| 28 | + |
| 29 | +Usage |
| 30 | +===== |
| 31 | + |
| 32 | +```python |
| 33 | +import MailboxValidator |
| 34 | + |
| 35 | + mbv = MailboxValidator.SingleValidation('PASTE_API_KEY_HERE') |
| 36 | + results = mbv.ValidateEmail( '[email protected]') |
| 37 | + |
| 38 | + if results is None: |
| 39 | + print("Error connecting to API.\n") |
| 40 | + elif results['error_code'] == '': |
| 41 | + print('email_address = ' + results['email_address'] + "\n") |
| 42 | + print('domain = ' + results['domain'] + "\n") |
| 43 | + print('is_free = ' + results['is_free'] + "\n") |
| 44 | + print('is_syntax = ' + results['is_syntax'] + "\n") |
| 45 | + print('is_domain = ' + results['is_domain'] + "\n") |
| 46 | + print('is_smtp = ' + results['is_smtp'] + "\n") |
| 47 | + print('is_verified = ' + results['is_verified'] + "\n") |
| 48 | + print('is_server_down = ' + results['is_server_down'] + "\n") |
| 49 | + print('is_greylisted = ' + results['is_greylisted'] + "\n") |
| 50 | + print('is_disposable = ' + results['is_disposable'] + "\n") |
| 51 | + print('is_suppressed = ' + results['is_suppressed'] + "\n") |
| 52 | + print('is_role = ' + results['is_role'] + "\n") |
| 53 | + print('is_high_risk = ' + results['is_high_risk'] + "\n") |
| 54 | + print('is_catchall = ' + results['is_catchall'] + "\n") |
| 55 | + print('mailboxvalidator_score = ' + str(results['mailboxvalidator_score']) + "\n") |
| 56 | + print('time_taken = ' + str(results['time_taken']) + "\n") |
| 57 | + print('status = ' + results['status'] + "\n") |
| 58 | + print('credits_available = ' + str(results['credits_available']) + "\n") |
| 59 | + else: |
| 60 | + print('error_code = ' + results['error_code'] + "\n") |
| 61 | + print('error_message = ' + results['error_message'] + "\n") |
| 62 | +``` |
| 63 | + |
| 64 | +Functions |
| 65 | +========= |
| 66 | + |
| 67 | +### SingleValidation(api_key) |
| 68 | + |
| 69 | +Creates a new instance of the MailboxValidator object with the API key. |
| 70 | + |
| 71 | +### ValidateEmail(email_address) |
| 72 | + |
| 73 | +Performs email validation on the supplied email address. |
| 74 | + |
| 75 | +Result Fields |
| 76 | +============= |
| 77 | + |
| 78 | +### email_address |
| 79 | + |
| 80 | +The input email address. |
| 81 | + |
| 82 | +### domain |
| 83 | + |
| 84 | +The domain of the email address. |
| 85 | + |
| 86 | +### is_free |
| 87 | + |
| 88 | +Whether the email address is from a free email provider like Gmail or Hotmail. |
| 89 | + |
| 90 | +Return values: True, False |
| 91 | + |
| 92 | +### is_syntax |
| 93 | + |
| 94 | +Whether the email address is syntactically correct. |
| 95 | + |
| 96 | +Return values: True, False |
| 97 | + |
| 98 | +### is_domain |
| 99 | + |
| 100 | +Whether the email address has a valid MX record in its DNS entries. |
| 101 | + |
| 102 | +Return values: True, False, - (- means not applicable) |
| 103 | + |
| 104 | +### is_smtp |
| 105 | + |
| 106 | +Whether the mail servers specified in the MX records are responding to connections. |
| 107 | + |
| 108 | +Return values: True, False, - (- means not applicable) |
| 109 | + |
| 110 | +### is_verified |
| 111 | + |
| 112 | +Whether the mail server confirms that the email address actually exist. |
| 113 | + |
| 114 | +Return values: True, False, - (- means not applicable) |
| 115 | + |
| 116 | +### is_server_down |
| 117 | + |
| 118 | +Whether the mail server is currently down or unresponsive. |
| 119 | + |
| 120 | +Return values: True, False, - (- means not applicable) |
| 121 | + |
| 122 | +### is_greylisted |
| 123 | + |
| 124 | +Whether the mail server employs greylisting where an email has to be sent a second time at a later time. |
| 125 | + |
| 126 | +Return values: True, False, - (- means not applicable) |
| 127 | + |
| 128 | +### is_disposable |
| 129 | + |
| 130 | +Whether the email address is a temporary one from a disposable email provider. |
| 131 | + |
| 132 | +Return values: True, False, - (- means not applicable) |
| 133 | + |
| 134 | +### is_suppressed |
| 135 | + |
| 136 | +Whether the email address is in our blacklist. |
| 137 | + |
| 138 | +Return values: True, False, - (- means not applicable) |
| 139 | + |
| 140 | +### is_role |
| 141 | + |
| 142 | +Whether the email address is a role-based email address like [email protected] or [email protected]. |
| 143 | + |
| 144 | +Return values: True, False, - (- means not applicable) |
| 145 | + |
| 146 | +### is_high_risk |
| 147 | + |
| 148 | +Whether the email address contains high risk keywords. |
| 149 | + |
| 150 | +Return values: True, False, - (- means not applicable) |
| 151 | + |
| 152 | +### is_catchall |
| 153 | + |
| 154 | +Whether the email address is a catch-all address. |
| 155 | + |
| 156 | +Return values: True, False, Unknown, - (- means not applicable) |
| 157 | + |
| 158 | +### mailboxvalidator_score |
| 159 | + |
| 160 | +Email address reputation score. |
| 161 | + |
| 162 | +Score > 0.70 means good; score > 0.40 means fair; score <= 0.40 means poor. |
| 163 | + |
| 164 | +### time_taken |
| 165 | + |
| 166 | +The time taken to get the results in seconds. |
| 167 | + |
| 168 | +### status |
| 169 | + |
| 170 | +Whether our system think the email address is valid based on all the previous fields. |
| 171 | + |
| 172 | +Return values: True, False |
| 173 | + |
| 174 | +### credits_available |
| 175 | + |
| 176 | +The number of credits left to perform validations. |
| 177 | + |
| 178 | +### error_code |
| 179 | + |
| 180 | +The error code if there is any error. See error table below. |
| 181 | + |
| 182 | +### error_message |
| 183 | + |
| 184 | +The error message if there is any error. See error table below. |
| 185 | + |
| 186 | +Errors |
| 187 | +====== |
| 188 | + |
| 189 | +| error_code | error_message | |
| 190 | +| ---------- | ------------- | |
| 191 | +| 100 | Missing parameter. | |
| 192 | +| 101 | API key not found. | |
| 193 | +| 102 | API key disabled. | |
| 194 | +| 103 | API key expired. | |
| 195 | +| 104 | Insufficient credits. | |
| 196 | +| 105 | Unknown error. | |
| 197 | + |
| 198 | +Copyright |
| 199 | +========= |
| 200 | + |
| 201 | +Copyright (C) 2018 by MailboxValidator.com, [email protected] |
0 commit comments