API Reference
Email address validation
Sending emails
- PROCEDURE send_email
- PROCEDURE send_to
- PROCEDURE send_cc
- PROCEDURE send_bcc
- PROCEDURE attach
- PROCEDURE reset
Email queue/job management
- PROCEDURE create_queue
- PROCEDURE drop_queue
- PROCEDURE purge_queue
- PROCEDURE push_queue
- PROCEDURE create_job
- PROCEDURE drop_job
- PROCEDURE purge_queue
- PROCEDURE purge_logs
- PROCEDURE create_purge_job
- PROCEDURE drop_purge_job
Query Mailgun
Mailgun tags
Suppressions (bounces, unsubscribes, and spam complaints)
- FUNCTION get_suppressions
- PROCEDURE delete_bounce
- PROCEDURE add_unsubscribe
- PROCEDURE delete_unsubscribe
- PROCEDURE delete_complaint
Other
Validate an email address (function wrapper). Parameters are:
- p_address - (required) email address to validate
Returns true if address appears to be valid.
Requires: Mailgun Public API Key, Mailgun API URL
begin
if mailgun_pkg.email_is_valid('chunkylover53@aol.com') then
dbms_output.put_line('email is valid');
else
dbms_output.put_line('email is invalid');
end if;
end;
Expected output:
email is valid
Validate an email address (procedure version). Parameters are:
- p_address - (required) email address to validate
- p_is_valid - (OUT) true if the email address appears to be valid
- p_suggestion - (OUT) suggested correction for email address (may or may not be provided, regardless of whether is_valid is true or false)
Requires: Mailgun Public API Key, Mailgun API URL
declare
is_valid boolean;
suggestion varchar2(512);
begin
mailgun_pkg.validate_email
(p_address => 'chunkylover53@aol'
,p_is_valid => is_valid
,p_suggestion => suggestion);
if is_valid then
dbms_output.put_line('email is valid');
else
dbms_output.put_line('email is invalid');
end if;
if suggestion is not null then
dbms_output.put_line('suggested: ' || suggestion);
end if;
end;
Expected output:
email is invalid
suggested: chunkylover53@aol.com
Sends an email. To add any attachments, call the attach procedures before calling this. To add multiple recipients, call the send_to/send_cc/send_bcc procedures before calling it. Does not commit - for the email to be sent your program must issue a COMMIT. If your program issues a ROLLBACK instead, the email will not be sent.
To send an email immediately, call mailgun_pkg.push_queue
immediately after. Otherwise, if you've created the job using create_job, it will be picked up the next time the job runs.
Parameters are:
- p_from_name - name of sender
- p_from_email - email address of sender (required if a default sender email has not been set - refer to init)
- p_reply_to - email address for Reply To
- p_to_name - name of recipient
- p_to_email - (required if no recipients already added) email address of recipient(s); don't set this if you have set up recipients using the send_xx procedures
- p_cc - email address(es) to CC (carbon copy) the email to
- p_bcc - email address(es) to BCC (blind carbon copy) the email to
- p_subject - (required) subject line
- p_message - (required) message body - html allowed (CLOB)
- p_tag - tag for this message (useful for topic-specific unsubscribe functionality)
- p_mail_headers - json structure of tag/value pairs (see example below)
- p_priority - priority for the queue; lower numbers are pulled from the queue first. Default is 3.
The recipient parameters (p_to_email, p_cc, p_bcc) can also accept comma-delimited lists of name <email>
, e.g. Bob <bob@host.com>, Jane <jane@host.com>
. In this case, you would not set p_to_name.
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
Send a simple email:
begin
mailgun_pkg.send_email
(p_from_email => 'Mr Sender <sender@example.com>'
,p_to_email => 'Ms Recipient <recipient@example.com>'
,p_subject => 'Test Subject'
,p_message => 'Test Email Body'
);
end;
Send an email using all the options, including adding an unsubscribe link:
begin
mailgun_pkg.send_email
(p_from_name => 'Mr Sender'
,p_from_email => 'sender@example.com'
,p_reply_to => 'reply@example.com'
,p_to_name => 'Mr Recipient'
,p_to_email => 'recipient@example.com'
,p_cc => 'Mrs CC <cc@example.com>'
,p_bcc => 'Ms BCC <bcc@example.com>'
,p_subject => 'Test Subject'
,p_message => '<html><body><strong>Test Email Body</strong>'
|| '<p>'
|| '<a href="' || mailgun_pkg.unsubscribe_link_tag || '">Unsubscribe</a>'
|| '</body></html>'
,p_tag => 'testtag2'
,p_mail_headers => '{ "Importance" : "high"' -- high/normal/low
|| ', "Priority" : "urgent"' -- normal/urgent/non-urgent
|| ', "Sensitivity" : "confidential"' -- personal/private/confidential
|| ', "Expires" : "' || to_char(systimestamp + interval '7' day
,mailgun_pkg.datetime_format)
|| '"' -- expiry date/time
|| '}'
,p_priority => 1
);
end;
Refer to the send_xx and attach procedures (below) for more samples.
Add a recipient to the "To" list. Call this BEFORE send_email
. Parameters:
-
p_email - (required) email address or email spec (e.g.
Bob Jones <bob.jones@example.com>
) - p_name - Full name of recipient (if not set, it will use First + Last name if provided)
- p_first_name - First / given name
- p_last_name - Last / surname
- p_id - ID or any other reference useful to your system
-
p_send_by - (default is "to") set to
'cc'
or'bcc'
to override the send method (otherwise, call send_cc or send_bcc)
begin
mailgun_pkg.send_to('Mr Recipient <recipient1@example.com>');
mailgun_pkg.send_to
(p_email => 'bob.jones@example.com'
,p_first_name => 'Bob'
,p_last_name => 'Jones'
,p_id => 'id123');
mailgun_pkg.send_to
(p_email => 'jane.doe@example.com'
,p_name => 'Jane Doe'
,p_send_by => 'cc');
mailgun_pkg.send_email
(p_from_email => 'Mr Sender <sender@example.com>'
,p_subject => 'test subject'
,p_message => 'Hi %recipient.first_name%,'
|| '<p>'
|| 'This is the email body.'
|| '<p>'
|| 'This email was sent to %recipient.name%.'
|| '<br>'
|| 'Reference: %recipient.id%'
|| '<p><a href="%unsubscribe_url%">Unsubscribe</a>'
);
mailgun_pkg.push_queue;
commit;
exception
when others then
mailgun_pkg.reset; -- clear any recipients from memory
raise;
end;
Add a recipient to the "CC" (Carbon Copy) list. Call this BEFORE send_email
. Parameters:
-
p_email - (required) email address or email spec (e.g.
Bob Jones <bob.jones@example.com>
) - p_name - Full name of recipient (if not set, it will use First + Last name if provided)
- p_first_name - First / given name
- p_last_name - Last / surname
- p_id - ID or any other reference useful to your system
begin
mailgun_pkg.send_cc('The Manager <manager@example.com>');
mailgun_pkg.send_email(...);
end;
Add a recipient to the "BCC" (Blind Carbon Copy) list. Call this BEFORE send_email
. Parameters:
-
p_email - (required) email address or email spec (e.g.
Bob Jones <bob.jones@example.com>
) - p_name - Full name of recipient (if not set, it will use First + Last name if provided)
- p_first_name - First / given name
- p_last_name - Last / surname
- p_id - ID or any other reference useful to your system
begin
mailgun_pkg.send_bcc('The Boss <ceo@example.com>');
mailgun_pkg.send_email(...);
end;
Call this BEFORE send_email
to add an attachment or inline image. Multiple attachments may be added. If inline is true, you can include the image in the email message by:
<img src="cid:myfilename.jpg">
- p_file_content - (required) CLOB or BLOB data (overloaded)
- p_file_name - (required) File name
-
p_content_type - (required) MIME content type, e.g.
image/png
- p_inline - (default is FALSE) - set to TRUE to send an inline image
-- send an email with some attachments
declare
clob_content clob;
blob_content blob;
begin
-- generate a largish text file
dbms_lob.createtemporary(clob_content,false);
clob_content := lpad('x', 32767, 'x');
dbms_lob.writeappend(clob_content, 32767, lpad('y',32767,'y'));
dbms_lob.writeappend(clob_content, 3, 'EOF');
dbms_output.put_line('file size=' || dbms_lob.getlength(clob_content));
-- load a binary file
-- source: https://github.com/mortenbra/alexandria-plsql-utils/blob/master/ora/file_util_pkg.pkb
blob_content := alex.file_util_pkg.get_blob_from_file
(p_directory_name => 'MY_DIRECTORY'
,p_file_name => 'myimage.jpg');
mailgun_pkg.attach
(p_file_content => 'this is my file contents'
,p_file_name => 'myfilesmall.txt'
,p_content_type => 'text/plain');
mailgun_pkg.attach
(p_file_content => clob_content
,p_file_name => 'myfilelarge.txt'
,p_content_type => 'text/plain');
mailgun_pkg.attach
(p_file_content => blob_content
,p_file_name => 'myimage.jpg'
,p_content_type => 'image/jpg'
,p_inline => true);
mailgun_pkg.send_email
(p_from_email => 'Mr Sender <sender@example.com>'
,p_to_email => 'Mrs Recipient <recipient@example.com>'
,p_subject => 'test subject ' || to_char(systimestamp,'DD/MM/YYYY HH24:MI:SS.FF')
,p_message => '<html><body><strong>Test Email Body</strong>'
|| '<p>'
|| 'There should be 2 attachments and an image below.'
|| '<p>'
|| '<img src="cid:myimage.jpg">'
|| '</body></html>'
);
mailgun_pkg.push_queue;
commit;
exception
when others then
mailgun_pkg.reset; -- clear any attachments from memory
raise;
end;
Call this to clear any recipients and attachments (note: send_email does this for you) e.g. if your proc raises an exception before it can send the email. No parameters.
begin
...mailgun_pkg. etc...
exception
when others then
mailgun_pkg.reset;
raise;
end;
Create the queue and related queue table for asynchronous emails. The queue is a required component for the API. The procedure has the following optional parameters:
- p_max_retries - (default is 10) allow this many failures before giving up on a message
- p_retry_delay - (default is 60) wait this many seconds before trying a failed message again
exec mailgun_pkg.create_queue;
Drop the queue and related queue table.
exec mailgun_pkg.drop_queue;
Purge any expired (failed) emails stuck in the queue. It takes the following optional parameter:
- p_msg_state (default is EXPIRED) - msg_state to purge; NULL means ALL messages in the queue get dropped
exec mailgun_pkg.purge_queue;
Send all emails in the queue. This can be done synchronously or asynchronously. This pulls any emails from the queue in order of priority, enqueue time, and calls the Mailgun API for each.
If the call to Mailgun fails on any particular email, it will stop further processing (emails sent up to that point will be successful). The failed email will be delayed in the queue for at least 10 seconds, and retried a maximum of 60 times before being dumped in the exception queue.
- p_asynchronous (default is TRUE)
If p_asynchronous = FALSE
(i.e. synchronous), the session will be COMMITted first and the queue processed in the calling session. The calling process will wait until the queue has been processed. This is the recommended setting for calling push_queue
from a job set up for this purpose.
exec mailgun_pkg.push_queue(p_asynchronous => false);
If p_asynchronous = TRUE
(i.e. asynchronous), no COMMIT is issued and the queue will be processed in a separate session (via DBMS_JOB) after the session has issued a COMMIT. If the session issues a ROLLBACK, the queue will not be processed. This is the recommended setting for calling push_queue from an application process.
begin
mailgun_pkg.send(...);
mailgun_pkg.push_queue;
end;
Create a scheduler job to periodically call push_queue
. It takes one parameter:
- p_repeat_interval - Override the default frequency for the job. The default frequency is every 5 minutes.
NOTE: if you decide to not create a job to periodically call
push_queue
, you must call it in your code every time you send an email.
exec mailgun_pkg.create_job (p_repeat_interval => 'FREQ=MINUTELY;INTERVAL=10;');
Drop the scheduler job which calls push_queue
.
exec mailgun_pkg.drop_job;
Delete mailgun_email_logs
where requested_ts
is older than the selected retention period. Issues a COMMIT.
- p_log_retention_days - override the default log retention period (number of days); if not set, the current setting is used; if that's not set, the default is 30 days.
exec mailgun_pkg.purge_logs (p_log_retention_days => 25);
Create a job to periodically call purge_logs
. Default is to run every Sunday at 12am.
exec mailgun_pkg.create_purge_job (p_repeat_interval => 'FREQ=DAILY;BYHOUR=0;');
Drop the job that calls purge_logs
.
exec mailgun_pkg.drop_purge_job;
Get email statistics.
- p_event_types - default is "all"; comma-delimited list of event types ("accepted", "delivered", "failed", "opened", "clicked", "unsubscribed", "complained", "stored")
- p_resolution - default is "day"; can be "hour", "day" or "month"
- p_start_time - default is 7 days prior to end time
- p_end_time - default is now
- p_duration - time counting backwards from p_end_time in units of p_resolution, e.g. 7 days
Returns a pipelined array of t_mailgun_stat
which comprises the following attributes:
- stat_datetime - date/time
- resolution - hour, day or month
- stat_name - e.g. "accepted" (refer to full list, below)
- stat_detail - e.g. "total"
- val - the number of email requests for this category
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
Get all stats for the last 7 days, by day:
select * from table(mailgun_pkg.get_stats);
Get all delivered for the last 24 hours, by hour:
select * from table(mailgun_pkg.get_stats
(p_event_types => 'delivered'
,p_resolution => 'hour'
,p_duration => 24));
Get all failed in the prior two months, by month:
select * from table(mailgun_pkg.get_stats
(p_event_types => 'failed'
,p_resolution => 'month'
,p_start_time => add_months(trunc(sysdate,'MM'), -2)
,p_end_time => trunc(sysdate,'MM') - 0.00001
));
The following statistics can be reported:
- accepted - incoming, outgoing, total
- delivered - smtp, http, total
- failed.temporary - espblock
- failed.permanent - suppress-bounce, suppress-unsubscribe, suppress-complaint, bounce, total
- stored - total
- opened - total
- clicked - total
- unsubscribed - total
- complained - total
NOTE: there are some limits that may result in the error
400 Bad Request
, e.g. asking for hourly resolution for more than a month.
Refer to https://documentation.mailgun.com/api-stats.html for more information on retention periods and for explanations of the various statistics.
Get email statistics for a tag.
- p_tag - (required) tag name - cannot contain spaces
- p_event_types - default is "all"; comma-delimited list of event types ("accepted", "delivered", "failed", "opened", "clicked", "unsubscribed", "complained", "stored")
- p_resolution - default is "day"; can be "hour", "day" or "month"
- p_start_time - default is 7 days prior to end time
- p_end_time - default is now
- p_duration - time counting backwards from p_end_time in units of p_resolution, e.g. 7 days
Returns a pipelined array of t_mailgun_stat
which comprises the following attributes:
- stat_datetime - date/time
- resolution - hour, day or month
- stat_name - e.g. "accepted" (refer to full list, below)
- stat_detail - e.g. "total"
- val - the number of email requests for this category
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
Get all stats for a tag for the last 7 days, by day:
select * from table(mailgun_pkg.get_tag_stats(p_tag => 'mytag'));
Refer to get_stats for more info about what is returned by this function.
Get a log of email events from mailgun for your account.
- p_start_time - default is now; query starting from this date/time
- p_end_time - stop returning events at this date/time; if this is a date/time prior to p_start_time, the events will be returned in reverse order. Default is to go back in history as far as possible.
- p_page_size - rows to fetch per API call; default 20; max 300
- p_event - filter expression on event type (accepted,rejected,delivered,failed,opened,clicked,unsubscribed,complained,stored)
-
p_sender - filter expression, e.g.
'"sample@example.com"'
-
p_recipient - filter expression, e.g.
'gmail OR hotmail'
-
p_subject - filter expression, e.g.
'foo AND bar'
-
p_tags - filter expression, e.g.
'NOT internal'
-
p_severity - for failed events:
'temporary'
or'permanent'
Returns a pipelined array of t_mailgun_event:
- event - event type
- event_ts - date/time
- event_id - unique id within the day
- message_id
- sender
- recipient
- subject
- attachments - comma-delimited list of file names
- size_bytes - total size in bytes of message and attachments
- method - e.g. smtp or http
- tags - comma-delimited list of tags
- user_variables - comma-delimited list of name/value pairs
- log_level - e.g. error, info
- failed_severity - e.g. temporary, permanent
- failed_reason
- delivery_status
- geolocation - for opened/clicked events
- recipient_ip - for opened/clicked events
- client_info - for opened/clicked events
- client_user_agent - for opened/clicked events
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
Get recent events log:
select * from table(mailgun_pkg.get_events);
Get failed emails, 50 records per API call:
select * from table(mailgun_pkg.get_events
(p_page_size => 50
,p_event => 'failed'));
Get emails successfully sent to anyone with a gmail or hotmail address on a particular day:
select * from table(mailgun_pkg.get_events
(p_event => 'delivered'
,p_start_time => date'2016-08-05'
,p_end_time => date'2016-08-06' - 0.00001
,p_recipient => 'gmail OR hotmail'
));
Get a list of tags.
- p_limit - maximum number of records to return (default 100)
Returns a pipelined array of t_mailgun_tag:
- tag_name
- description
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
select * from table(mailgun_pkg.get_tags);
Add or update a tag.
Note: you don't need to create a tag in order to use it. It will be created automatically the first time it's used (e.g. when you call
send_email
).
Warning: Mailgun tag limit per domain is 4000.
- p_tag - (required) name of the tag (cannot contain spaces)
- p_description - (optional) description for the tag
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.update_tag
(p_tag => 'mytag'
,p_description => 'my tag description');
end;
Delete a tag.
- p_tag - (required) name of the tag (cannot contain spaces)
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.delete_tag (p_tag => 'badtag');
end;
Get bounces, unsubscribes, or spam complaints.
-
p_type - (required)
'bounces'
,'unsubscribes'
or'complaints'
- p_limit - max rows to fetch (default 100)
Returns a pipelined array of t_mailgun_suppression:
-
suppression_type -
'bounce'
,'unsubscribe'
, or'complaint'
- email_address
- unsubscribe_tag - unsubscribed from a particular tag
- bounce_code
- bounce_error - reason / error info for bounce
- created_dt - date/time when the address was added to the list
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
Get bounces
select * from table(mailgun_pkg.get_suppressions(p_type => 'bounces'));
Get unsubscribes
select * from table(mailgun_pkg.get_suppressions(p_type => 'unsubscribes'));
Get spam complaints
select * from table(mailgun_pkg.get_suppressions(p_type => 'complaints'));
Remove an email address from the bounce list.
- p_email_address - (required)
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.delete_bounce (p_email_address => 'sample@example.com');
end;
Add an email to the unsubscribed list.
- p_email_address - (required)
- p_tag - (optional) just for the specified tag
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.add_unsubscribe (p_email_address => 'sample@example.com');
end;
Add an email to the unsubscribed list for a particular tag
begin
mailgun_pkg.add_unsubscribe
(p_email_address => 'sample@example.com'
,p_tag => 'mytag');
end;
Remove an email from the unsubscribed list.
- p_email_address - (required)
- p_tag - (optional) just for the specified tag
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.delete_unsubscribe (p_email_address => 'sample@example.com');
end;
Remove an email from the unsubscribed list for a particular tag
begin
mailgun_pkg.delete_unsubscribe
(p_email_address => 'sample@example.com'
,p_tag => 'mytag');
end;
Remove an email address from the spam complaints list.
- p_email_address - (required)
Requires: Mailgun Private API Key, Mailgun API URL, your Mailgun Domain
begin
mailgun_pkg.delete_complaint (p_email_address => 'sample@example.com');
end;
Set up the system or update your mailgun parameters. This updates the mailgun_settings
table. Each parameter may be set or unset independently; parameters not specifically set will be left unchanged. If successful, this procedure issues a COMMIT.
- p_public_api_key - required for validating email addresses
- p_private_api_key - required for sending emails and querying your stats/logs
- p_my_domain - required for sending emails
- p_api_url - if not set, the default https mailgun endpoint will be used - change this if you are using Method 2 (Reverse Proxy)
- p_wallet_path - your Oracle wallet path
- p_wallet_password - your Oracle wallet password
-
p_log_retention_days - number of days to retain email logs (used by
purge_logs
) - p_default_sender_name - default sender name (only used if default sender email is used; optional)
- p_default_sender_email - default sender email address (used if p_from_email is left blank)
- p_queue_expiration - failed emails wait in the queue for this many seconds (default is 24 hours)
- p_prod_instance_name - global_name for your production database instance (all other instances will be treated as non-prod)
- p_non_prod_recipient - If set, emails in non-prod instances have recipients replaced with this. If not set, emails are suppressed in non-prod instances.
- p_required_sender_domain - If set, all recipients must be in this domain
- p_recipient_whitelist - If set, all recipients must be in this whitelist of email addresses separated by semicolons (;)
-
p_whitelist_action - If
'suppress'
, emails to non-whitelist recipients are dropped silently. If'raise_exception'
, emails to non-whitelist recipients will cause an exception to be raised. If set to an email address, emails to non-whitelist recipients will be redirected to this email address instead. - p_max_email_size_mb - maximum email size (in mb) allowed (default is null; null means API does no checking but leaves it up to Mailgun)
For more info, refer to the Installation instructions.
Set your mailgun parameters:
begin
mailgun_pkg.init
(p_public_api_key => '...your PUBLIC Mailgun API key...'
,p_private_api_key => '...your SECRET Mailgun API key...'
,p_my_domain => '...your domain...');
end;
Set up for Method 1 (Oracle Wallet):
begin
mailgun_pkg.init
(p_wallet_path => '...your wallet path...'
,p_wallet_password => '...your wallet password...');
end;
Set up for Method 2 (Reverse Proxy):
begin
mailgun_pkg.init
(p_api_url => 'http://api.mydomain.com/mailgun/v3/');
end;
Set the other optional parameters:
begin
mailgun_pkg.init
(p_log_retention_days => 25
,p_default_sender_name => 'Postmaster'
,p_default_sender_email => 'postmaster@example.com'
,p_queue_expiration => (48 * 60 * 60));
end;
Send a test email. Use this to test whether your system is able to connect to Mailgun and send an email. This bypasses the queue and connects directly. Optionally, you can test different settings without needing to change them permanently.
All parameters are optional except for p_to_email.
- p_from_name - sender's name; if both this and p_from_email are null, the default sender name is used
- p_from_email - sender's email; if null, the default sender email address is used
- p_to_name - recipient name
- p_to_email - (required) recipient email address
- p_subject - if null, a subject will be generated
- p_message - if null, a message will be generated
- p_private_api_key - Mailgun secret API key to use instead of the stored setting
- p_my_domain - an alternative domain to use instead of the stored setting
- p_api_url - alternative API url to use instead of the stored setting
- p_wallet_path - alternative wallet path to use instead of the stored setting
- p_wallet_password - alternative wallet password to use instead of the stored setting
You may use the following constants to insert these substitution strings in your email subject or message. These are interpreted by Mailgun.
mailgun_pkg.unsubscribe_link_all = %unsubscribe_url%
mailgun_pkg.unsubscribe_link_tag = %tag_unsubscribe_url%
mailgun_pkg.recipient_name = %recipient.name%
mailgun_pkg.recipient_first_name = %recipient.first_name%
mailgun_pkg.recipient_last_name = %recipient.last_name%
mailgun_pkg.recipient_id = %recipient.id%
mailgun_pkg.recipient_email = %recipient.email%
You may use the following constant when sending a date as a formatted string to be interpreted by mailgun's API:
mailgun_pkg.datetime_format = Dy, dd Mon yyyy hh24:mi:ss tzh:tzm
You may use the following constant if you don't have access to UTL_TCP.CRLF
:
mailgun_pkg.crlf = CRLF
You may use the following constants when setting p_recipient_whitelist
:
mailgun_pkg.whitelist_suppress = suppress
mailgun_pkg.whitelist_raise_exception = raise_exception