All URIs are relative to https://api.mailbaby.net
| Method | HTTP request | Description |
|---|---|---|
| add_rule | POST /mail/rules | Creates a new email deny rule |
| delete_rule | DELETE /mail/rules/{ruleId} | Removes a deny mail rule |
| delist_block | POST /mail/blocks/delete | Removes an email address from the block lists |
| get_mail_blocks | GET /mail/blocks | Displays a list of blocked email addresses |
| get_rules | GET /mail/rules | Displays a listing of deny email rules |
GenericResponse add_rule(type, data, user=user)
Creates a new email deny rule
Adds a deny rule to block specific senders, domains, destinations, or sender prefixes from being relayed through your mail account.
The type field selects the matching strategy:
email— exact match against the SMTP envelopeMAIL FROMaddress. -domain— matches any sender address at the specified domain. -destination— exact match against the SMTP envelopeRCPT TOaddress. -startswith— matches any sender address whose local-part (the portion before the@) starts with the given string. Only alphanumeric characters and+,_,.,-are permitted in the prefix.
If username is provided it must be the SMTP username of one of your active mail orders (e.g. mb20682). If omitted the rule is associated with your first active order.
On success the response text field contains the newly created rule's id, which can later be passed to DELETE /mail/rules/{ruleId} to remove it.
- Api Key Authentication (apiKeyAuth):
import openapi_client
from openapi_client.models.generic_response import GenericResponse
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.mailbaby.net"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BlockingApi(api_client)
type = 'type_example' # str | The matching strategy for this rule. `email` blocks an exact sender address, `domain` blocks all senders at a domain, `destination` blocks an exact recipient address, and `startswith` blocks any sender whose local-part begins with the given prefix.
data = 'data_example' # str | The value to match against, interpreted according to `type`: a full email address for `email`/`destination`, a domain name for `domain`, or an alphanumeric prefix string for `startswith`.
user = 'user_example' # str | Optional SMTP username of the mail order to associate this rule with (e.g. `mb20682`). If omitted the first active order is used. Valid usernames are the `username` values returned by `GET /mail`. (optional)
try:
# Creates a new email deny rule
api_response = api_instance.add_rule(type, data, user=user)
print("The response of BlockingApi->add_rule:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BlockingApi->add_rule: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| type | str | The matching strategy for this rule. `email` blocks an exact sender address, `domain` blocks all senders at a domain, `destination` blocks an exact recipient address, and `startswith` blocks any sender whose local-part begins with the given prefix. | |
| data | str | The value to match against, interpreted according to `type`: a full email address for `email`/`destination`, a domain name for `domain`, or an alphanumeric prefix string for `startswith`. | |
| user | str | Optional SMTP username of the mail order to associate this rule with (e.g. `mb20682`). If omitted the first active order is used. Valid usernames are the `username` values returned by `GET /mail`. | [optional] |
- Content-Type: application/x-www-form-urlencoded, application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Rule created successfully | - |
| 400 | Bad request — one or more input parameters were missing or invalid. | - |
| 401 | Authentication failed. Ensure you are sending a valid `X-API-KEY` header. Obtain your API key from my.interserver.net/account_security. | - |
| 404 | The specified resource was not found or does not belong to your account. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GenericResponse delete_rule(rule_id)
Removes a deny mail rule
Permanently removes a single deny rule identified by its numeric ruleId.
The ruleId is the id field returned by GET /mail/rules or the text field from a successful POST /mail/rules response.
Only rules belonging to your own active mail account(s) can be deleted — the server will reject attempts to delete rules that belong to a different account.
- Api Key Authentication (apiKeyAuth):
import openapi_client
from openapi_client.models.generic_response import GenericResponse
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.mailbaby.net"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BlockingApi(api_client)
rule_id = 34 # int | The numeric ID of the deny rule to delete. Obtain this from the `id` field in `GET /mail/rules` or the `text` field of a `POST /mail/rules` response.
try:
# Removes a deny mail rule
api_response = api_instance.delete_rule(rule_id)
print("The response of BlockingApi->delete_rule:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BlockingApi->delete_rule: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| rule_id | int | The numeric ID of the deny rule to delete. Obtain this from the `id` field in `GET /mail/rules` or the `text` field of a `POST /mail/rules` response. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Rule deleted successfully | - |
| 400 | Bad request — one or more input parameters were missing or invalid. | - |
| 401 | Authentication failed. Ensure you are sending a valid `X-API-KEY` header. Obtain your API key from my.interserver.net/account_security. | - |
| 404 | The specified resource was not found or does not belong to your account. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GenericResponse delist_block(email_address_param)
Removes an email address from the block lists
Delists an email address from all three block list stores:
- The rspamd spam-filter database (
fromemail/ envelope sender records). 2. The MailChannels integration block table. 3. The MailBaby internal block table.
Use GET /mail/blocks to discover which addresses are currently blocked. The from field in any returned block entry is a valid input for this call.
Note: Delisting an address removes it from the block tracking databases but does not prevent the spam filter from re-blocking it if future messages continue to trigger filter rules.
- Api Key Authentication (apiKeyAuth):
import openapi_client
from openapi_client.models.email_address_param import EmailAddressParam
from openapi_client.models.generic_response import GenericResponse
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.mailbaby.net"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BlockingApi(api_client)
email_address_param = {"email":"client@domain.com"} # EmailAddressParam |
try:
# Removes an email address from the block lists
api_response = api_instance.delist_block(email_address_param)
print("The response of BlockingApi->delist_block:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BlockingApi->delist_block: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| email_address_param | EmailAddressParam |
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Address successfully delisted | - |
| 400 | Bad request — one or more input parameters were missing or invalid. | - |
| 401 | Authentication failed. Ensure you are sending a valid `X-API-KEY` header. Obtain your API key from my.interserver.net/account_security. | - |
| 404 | The specified resource was not found or does not belong to your account. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MailBlocks get_mail_blocks()
Displays a list of blocked email addresses
Returns addresses and messages that have been flagged by the spam filtering system for your mail account(s). Three categories are returned:
local— messages flagged by theLOCAL_BL_RCPTrspamd rule. These are messages sent to recipients on your account's local block list.mbtrap— messages flagged by theMBTRAPrspamd rule. These are messages that triggered MailBaby's internal trap / honeypot detection.subject— senders whose recent messages contain spam-indicative subjects (strings containing@,smtp,socks4, orsocks5) with high repetition (more than 4 identical subjects from the same sender in the last 3 days).
The local and mbtrap results cover the last 5 days. The subject results cover the last 3 days.
A sender address returned in any of these lists can be delisted using POST /mail/blocks/delete with the email field set to that address.
- Api Key Authentication (apiKeyAuth):
import openapi_client
from openapi_client.models.mail_blocks import MailBlocks
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.mailbaby.net"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BlockingApi(api_client)
try:
# Displays a list of blocked email addresses
api_response = api_instance.get_mail_blocks()
print("The response of BlockingApi->get_mail_blocks:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BlockingApi->get_mail_blocks: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Authentication failed. Ensure you are sending a valid `X-API-KEY` header. Obtain your API key from my.interserver.net/account_security. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List[DenyRuleRecord] get_rules()
Displays a listing of deny email rules
Returns all deny rules you have configured for your active mail account(s). Deny rules are evaluated before a message is transmitted and cause it to be rejected immediately when it matches.
Four rule types are supported:
| type | data format | Effect | |--------|---------------|--------| | email | user@domain.com | Rejects any message from this exact sender address | | domain | domain.com | Rejects any message from any address at this domain | | destination | user@domain.com | Rejects any message addressed to this recipient | | startswith | prefix | Rejects any message whose sender address begins with this string (alphanumeric, +, _, ., - only) |
Use POST /mail/rules to add new rules and DELETE /mail/rules/{ruleId} to remove them. The id field in each returned record is the value needed for the delete call.
- Api Key Authentication (apiKeyAuth):
import openapi_client
from openapi_client.models.deny_rule_record import DenyRuleRecord
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.mailbaby.net"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BlockingApi(api_client)
try:
# Displays a listing of deny email rules
api_response = api_instance.get_rules()
print("The response of BlockingApi->get_rules:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BlockingApi->get_rules: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Authentication failed. Ensure you are sending a valid `X-API-KEY` header. Obtain your API key from my.interserver.net/account_security. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]