Skip to content

Commit 1e67554

Browse files
author
MailboxValidator
committed
Add Readthedocs documentation.
1 parent a3ab868 commit 1e67554

File tree

11 files changed

+364
-0
lines changed

11 files changed

+364
-0
lines changed

.readthedocs.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/source/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
# formats:
24+
# - pdf
25+
# - epub
26+
27+
# Optional but recommended, declare the Python requirements required
28+
# to build your documentation
29+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Defining the exact version will make sure things don't break
2+
sphinx-book-theme==1.0.1
3+
# sphinx-pdj-theme==0.4.0
4+
myst-parser==2.0.0
5+
markdown-it-py==3.0.0
6+
sphinx-copybutton==0.5.2

docs/source/code.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# MailboxValidator Rust API
2+
3+
```{py:function} validate_email(email, api_key)
4+
Validate whether an email address is a valid email or not.
5+
6+
:param str email: (Required) The email address.
7+
8+
:return: Returns the validation result in JSON object.
9+
:rtype: Object
10+
11+
**Successful Response Parameters**
12+
| Field Name | Description |
13+
|-----------|------------|
14+
| email_address | The input email address. |
15+
| base_email_address | The input email address after sanitizing the username of the dots (only Gmail) and [subaddressing](https://en.wikipedia.org/wiki/Email_address#Sub-addressing). |
16+
| domain | The domain of the email address. |
17+
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: true, false, null (null means not applicable) |
18+
| is_syntax | Whether the email address is syntactically correct. Return values: true, false |
19+
| is_domain | Whether the email address has a valid MX record in its DNS entries. Return values: true, false, null (null means not applicable) |
20+
| is_smtp | Whether the mail servers specified in the MX records are responding to connections. Return values: true, false, null (null means not applicable) |
21+
| is_verified | Whether the mail server confirms that the email address actually exist. Return values: true, false, null (null means not applicable) |
22+
| is_server_down | Whether the mail server is currently down or unresponsive. Return values: true, false, null (null means not applicable) |
23+
| 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) |
24+
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: true, false, null (null means not applicable) |
25+
| is_suppressed | Whether the email address is in our blacklist. Return values: true, false, null (null means not applicable) |
26+
| is_role | Whether the email address is a role-based email address like admin@example.net or webmaster@example.net. Return values: true, false, null (null means not applicable) |
27+
| is_high_risk | Whether the email address contains high risk keywords. Return values: true, false, null (null means not applicable) |
28+
| is_catchall | Whether the email address is a catch-all address. Return values: true, false, null (null means not applicable) |
29+
| is_dmarc_enforced | Whether the email domain is enforcing DMARC. Return values: true, false |
30+
| is_strict_spf | Whether the email domain is using strict SPF. Return values: true, false |
31+
| website_exist | Whether the email domain is a reachable website. Return values: true, false |
32+
| mailboxvalidator_score | Email address reputation score. Score > 0.70 means good; score > 0.40 means fair; score <= 0.40 means poor. |
33+
| time_taken | The time taken to get the results in seconds. |
34+
| status | Whether our system think the email address is valid based on all the previous fields. Return values: True, False |
35+
| credits_available | The number of credits left to perform validations. |
36+
37+
**Error Response Parameters**
38+
| Field Name | Description |
39+
|-----------|------------|
40+
| error.error_code | The error code if there is any error. See error table in the [Error Codes](reference.md) section. |
41+
| error.error_message | The error message if there is any error. See error table in the [Error Codes](reference.md) section. |
42+
43+
```
44+
45+
```{py:function} is_disposable_email(email, api_key)
46+
Validate whether an email address is a disposable email or not.
47+
48+
:param str email: (Required) The email address.
49+
50+
:return: Returns the validation result in JSON object.
51+
:rtype: Object
52+
53+
**Successful Response Parameters**
54+
| Field Name | Description |
55+
|-----------|------------|
56+
| email_address | The input email address. |
57+
| is_disposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False |
58+
| credits_available | The number of credits left to perform validations. |
59+
60+
61+
**Error Response Parameters**
62+
| Field Name | Description |
63+
|-----------|------------|
64+
| error.error_code | The error code if there is any error. See error table in the [Error Codes](reference.md) section. |
65+
| error.error_message | The error message if there is any error. See error table in the [Error Codes](reference.md) section. |
66+
67+
```
68+
69+
```{py:function} is_free_email(email, api_key)
70+
Validate whether an email address is a free email or not.
71+
72+
:param str email: (Required) The email address.
73+
74+
:return: Returns the validation result in JSON object.
75+
:rtype: Object
76+
77+
**Successful Response Parameters**
78+
| Field Name | Description |
79+
|-----------|------------|
80+
| email_address | The input email address. |
81+
| is_free | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False |
82+
| credits_available | The number of credits left to perform validations. |
83+
84+
85+
**Error Response Parameters**
86+
| Field Name | Description |
87+
|-----------|------------|
88+
| error.error_code | The error code if there is any error. See error table in the [Error Codes](reference.md) section. |
89+
| error.error_message | The error message if there is any error. See error table in the [Error Codes](reference.md) section. |
90+
91+
```
92+

docs/source/conf.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# Read https://www.sphinx-doc.org/en/master/usage/configuration.html for more options available
3+
4+
# import sphinx_pdj_theme
5+
6+
# -- Project information
7+
8+
project = 'MailboxValidator Rust'
9+
copyright = '2024, MailboxValidator'
10+
author = 'MailboxValidator'
11+
12+
release = '0.1.0'
13+
version = '0.1.0'
14+
15+
# -- General configuration
16+
17+
extensions = [
18+
'sphinx.ext.duration',
19+
'sphinx.ext.doctest',
20+
'myst_parser',
21+
'sphinx_copybutton',
22+
]
23+
24+
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
25+
26+
myst_enable_extensions = [
27+
"colon_fence",
28+
"deflist",
29+
"fieldlist",
30+
]
31+
32+
# https://myst-parser.readthedocs.io/en/latest/configuration.html#setting-html-metadata
33+
myst_html_meta = {
34+
"description": "MailboxValidator Rust module enable users to block disposal email, detect free email and validate if an email is valid.",
35+
"keywords": "MailboxValidator, Email Validation, disposable email, free email, Rust",
36+
"google-site-verification": "DeW6mXDyMnMt4i61ZJBNuoADPimo5266DKob7Z7d6i4",
37+
}
38+
39+
# templates_path = ['_templates']
40+
41+
# -- Options for HTML output
42+
43+
html_theme = 'sphinx_book_theme'
44+
# html_theme_path = [sphinx_pdj_theme.get_html_theme_path()]
45+
46+
# PDJ theme options, see the list of available options here: https://github.com/jucacrispim/sphinx_pdj_theme/blob/master/sphinx_pdj_theme/theme.conf
47+
html_theme_options = {
48+
"use_edit_page_button": False,
49+
"use_source_button": False,
50+
"use_issues_button": False,
51+
"use_download_button": False,
52+
"use_sidenotes": False,
53+
}
54+
55+
# The name of an image file (relative to this directory) to place at the top
56+
# of the sidebar.
57+
html_logo = 'images/mbv-logo-square-1200.png'
58+
59+
# Favicon
60+
html_favicon = 'images/favicon.ico'
61+
62+
html_title = "MailboxValidator Rust"
63+
64+
# html_baseurl = "https://ip2proxy-php.readthedocs.io/en/latest/"

docs/source/images/favicon.ico

7.23 KB
Binary file not shown.
31 KB
Loading

docs/source/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
![Crates.io](https://img.shields.io/crates/d/mailboxvalidator)
2+
3+
# MailboxValidator Rust package
4+
5+
This Rust package enables user to easily validate if an email address is valid, a type of disposable email or free email.
6+
7+
This module can be useful in many types of projects, for example
8+
9+
- to validate an user's email during sign up
10+
- to clean your mailing list prior to email sending
11+
- to perform fraud check
12+
- and so on
13+
14+
15+
## Table of contents
16+
```{eval-rst}
17+
.. toctree::
18+
19+
self
20+
quickstart
21+
code
22+
reference
23+
```

docs/source/quickstart.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Quickstart
2+
3+
## Dependencies
4+
5+
An API key is required for this module to function.
6+
7+
Go to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key.
8+
9+
## Installation
10+
11+
Just add `mailboxvalidator = "1.1.1"` into your *Cargo.toml*.
12+
13+
## Sample Codes
14+
15+
### Validate email
16+
17+
You can validate whether an email address is invalid or not as below:
18+
19+
```rust
20+
use mailboxvalidator;
21+
22+
let validation_result = mailboxvalidator::validate_email("example@example.com",PASTE_API_KEY_HERE);
23+
24+
match validation_result {
25+
Ok(num) => {
26+
let ok_result = num;
27+
println!("{:#?}", ok_result);
28+
},
29+
Err(err) => println!("{:#?}", err),
30+
};
31+
```
32+
33+
### Check if an email is from a disposable email provider
34+
35+
You can validate whether an email address is disposable email address or not as below:
36+
37+
```rust
38+
use mailboxvalidator;
39+
40+
let validation_result = mailboxvalidator::is_disposable_email("example@example.com",PASTE_API_KEY_HERE);
41+
42+
match validation_result {
43+
Ok(num) => {
44+
let ok_result = num;
45+
println!("{:#?}", ok_result);
46+
},
47+
Err(err) => println!("{:#?}", err),
48+
};
49+
```
50+
51+
### Check if an email is from a free email provider
52+
53+
You can validate whether an email address is free email address or not as below:
54+
55+
```rust
56+
use mailboxvalidator;
57+
58+
let validation_result = mailboxvalidator::is_free_email("example@example.com",PASTE_API_KEY_HERE);
59+
60+
match validation_result {
61+
Ok(num) => {
62+
let ok_result = num;
63+
println!("{:#?}", ok_result);
64+
},
65+
Err(err) => println!("{:#?}", err),
66+
};
67+
```

0 commit comments

Comments
 (0)