{"id":19993,"date":"2025-01-07T00:00:00","date_gmt":"2025-01-07T00:00:00","guid":{"rendered":"https:\/\/www.mailgun.com\/blog\/verifier-emails-python-api\/"},"modified":"2026-09-14T22:52:51","modified_gmt":"2026-09-14T22:52:51","slug":"verifier-emails-python-api","status":"publish","type":"blog","link":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/","title":{"rendered":"V\u00e9rifier des emails avec Python 3.9+ et l&rsquo;API de Mailgun"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Whether you&rsquo;re sending transactional emails, newsletters, or promotional content, maintaining a clean and verified email list can significantly improve deliverability, prevent your messages from ending up in spam folders, and protect your domain&rsquo;s reputation. Invalid or mistyped email addresses can lead to higher bounce rates, resulting in penalties from email service providers and reduced engagement. In this guide you\u2019ll learn how to verify your emails with the Mailgun API.<\/p>\n\r\n    <nav data-content-type=\"longform\" class=\"toc-block longform-spacings px-5 py-6 px-md-6 px-lg-7 py-md-7 bg-light fs-sm rounded-lg\" aria-labelledby=\"toc-title-3554\"><p class=\"h5 m-0\" id=\"toc-title-3554\">Table des mati\u00e8res<\/p><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">01<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#what-is-mailguns-bulk-email-validation-api\">What is Mailgun\u2019s Bulk Email Validation API?<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">02<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#implementing-bulk-email-validation-with-python-and-the-mailgun-api\">Implementing bulk email validation with Python and the Mailgun API<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">03<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#setting-up-mailgun-for-bulk-email-validation\">Setting up Mailgun for bulk email validation<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">04<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#setting-up-a-project-directory-and-dependencies\">Setting up a project directory and dependencies<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">05<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#creating-a-python-project-and-configuration-script\">Creating a Python project and configuration script<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">06<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#preparing-your-mailing-list-file\">Preparing your mailing list file<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">07<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#creating-a-bulk-validation-job\">Creating a bulk validation job<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">08<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#developing-functions-to-check-job-status-and-download-results\">Developing functions to check job status and download results<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">09<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#developing-functions-to-check-job-status-and-download-results\">Developing functions to check job status and download results<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">10<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#parsing-and-handling-validation-results\">Parsing and handling validation results<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">11<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#the-final-script\">The final script<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">12<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#testing-by-submitting-a-bulk-email-validation-job-request\">Testing by submitting a bulk email validation job request<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">13<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#testing-by-fetching-the-status-of-the-bulk-email-validation-job\">Testing by fetching the status of the bulk email validation job<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">14<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#integrating-bulk-email-validation-in-a-django-application\">Integrating bulk email validation in a Django application<\/a><\/div><\/div><div class=\"d-flex mt-3\"><div class=\"w-auto fw-bold text-accent d-flex me-2\">15<\/div><div class=\"d-flex flex-column\"><a class=\"fw-bold scrollme link-body-color text-accent\" href=\"#wrapping-up\">Wrapping up<\/a><\/div><\/div><\/nav>\n<h2 class=\"wp-block-heading\">What is Mailgun\u2019s Bulk Email Validation API?<\/h2>\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/documentation.mailgun.com\/docs\/inboxready\/mailgun-validate\/bulk_valid_preview\/\" target=\"_tabs\" rel=\"noopener noreferrer\">Mailgun&rsquo;s Bulk Email Validation API<\/a> is designed to make email verification both scalable and efficient. With it, developers can validate entire lists of email addresses, checking for common issues such as syntax errors, disposable emails, or addresses with inactive mail servers. The API provides detailed results for each email, making it easy to take the appropriate action.<\/p>\n\n<p class=\"wp-block-paragraph\">In this tutorial, you&rsquo;ll learn how to integrate Mailgun&rsquo;s Bulk Email Validation API into your Python applications. From setting up your Mailgun account and securely handling credentials to writing code that validates emails and processes the results, this guide provides step-by-step instructions to efficiently verify large email lists.<\/p>\n\n<h2 class=\"wp-block-heading\">Implementing bulk email validation with Python and the Mailgun API<\/h2>\n\n<p class=\"wp-block-paragraph\">Before you start working through this tutorial, make sure you have the following:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>A basic understanding of Python programming<\/li>\n\n\n\n<li><a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_tabs\" rel=\"noopener noreferrer\">Python<\/a> 3.9+<\/li>\n\n\n\n<li>A <a href=\"https:\/\/signup.mailgun.com\/new\/signup\" target=\"_tabs\" rel=\"noopener noreferrer\">Mailgun account<\/a>; a paid account is required for this tutorial<\/li>\n\n\n\n<li>Experience with application development based on <a href=\"https:\/\/www.django-rest-framework.org\/\" target=\"_tabs\" rel=\"noopener noreferrer\">Django REST framework<\/a><\/li>\n<\/ul>\n\n<p class=\"wp-block-paragraph\">This tutorial uses the Windows operating system. While all of the instructions should also work for Linux and macOS, make sure to change the operating system path delimiters or syntax references as needed.<\/p>\n\n<h2 class=\"wp-block-heading\">Setting up Mailgun for bulk email validation<\/h2>\n\n<p class=\"wp-block-paragraph\">To start, <a href=\"https:\/\/app.mailgun.com\/\" target=\"_tabs\" rel=\"noopener noreferrer\">log in to your Mailgun account<\/a> and navigate to the dashboard. Scroll down and select the <b>API keys<\/b> option:<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4069\" width=\"1958\" height=\"876\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM.png\" alt=\"API keys option scrfeen\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM.png 1958w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM-300x134.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM-768x344.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM-1024x458.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.38_AM-1536x687.png 1536w\" sizes=\"(max-width: 1958px) 100vw, 1958px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">Click <b>Add new key<\/b> to add a new API key:<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4075\" width=\"1958\" height=\"522\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM.png\" alt=\"Add new key to add a new API key screen\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM.png 1958w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM-300x80.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM-768x205.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM-1024x273.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.48_AM-1536x409.png 1536w\" sizes=\"(max-width: 1958px) 100vw, 1958px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">Type in a description (such as \u00ab\u00a0Bulk Email Validation API Key\u00a0\u00bb) and click <b>Create Key<\/b>:<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4079\" width=\"1960\" height=\"790\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM.png\" alt=\"Create Key screen\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM.png 1960w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM-300x121.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM-768x310.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM-1024x413.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.18.56_AM-1536x619.png 1536w\" sizes=\"(max-width: 1960px) 100vw, 1960px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">Once the API key is created, copy the key information, as you&rsquo;ll need it later on. If you forget to copy the information or lose the key, don&rsquo;t worry; you can delete your API key and create a new one.<\/p>\n\n<h2 class=\"wp-block-heading\">Setting up a project directory and dependencies<\/h2>\n\n<p class=\"wp-block-paragraph\">Create a project directory on your machine and switch to that directory. Next, open a terminal with a path set to the current project directory and execute the following command to create a Python virtual environment for this tutorial:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>python -m venv venv<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">Activate the virtual environment:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>venvScriptsactivate<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">Then, install the requests library, which will be used to interact with Mailgun endpoints:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>pip install requests<\/code><\/p>\n\n<h2 class=\"wp-block-heading\">Creating a Python project and configuration script<\/h2>\n\n<p class=\"wp-block-paragraph\">Once you&rsquo;ve activated your virtual environment, create a new directory inside the project directory named <code>standalone_python_scripts<\/code>, where you&rsquo;ll develop the Python modules required to carry out bulk email validation using Mailgun endpoints.<\/p>\n\n<p class=\"wp-block-paragraph\">In this new directory, create a new Python file named <code>config.py<\/code> and paste in the following code to configure the standalone Python script application:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    import osrnrn# Retrieve the API key from the environment variablernrnAPI_KEY = os.getenv(&quot;MAILGUN_API_KEY&quot;)rnrn# Mailgun API base URLrnrnMAILGUN_API_URL = &quot;https:\/\/api.mailgun.net\/v4\/address\/validate\/bulk&quot;rnrnLIST_NAME = &quot;bulk_mailing_list_validation_1&quot;rnrnFILE_PATH = &quot;mailing_list.csv&quot;rnrnCOMMAND = &quot;submit_job&quot; # Possible values are &quot;submit_job&quot; and &quot;get_job_status&quot;rn\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">This config module holds the configuration variables required for carrying out the bulk email validation request.<\/p>\n\n<p class=\"wp-block-paragraph\">Set up a new environment variable, MAILGUN_API_KEY, on your host machine by running the following command:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>SET MAILGUN_API_KEY=<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">This assigns the API key that you generated earlier during Mailgun account setup.<\/p>\n\n<p class=\"wp-block-paragraph\">If you&rsquo;re a Linux or Mac user, execute the following command:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>export MAILGUN_API_KEY=<\/code><\/p>\n    <div data-content-type=\"longform\"  class=\"callout text-body-color px-5 py-6 px-md-6 px-lg-7 py-md-7 longform-spacings rounded-lg bg-light\" data-theme=\"light\">\r\n\r\n        <div class=\"content-body\"> By storing the API key in an environment variable instead of hard-coding it in the config file, you keep sensitive information protected.<\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">Leave the other variables&rsquo; values as is for now. The LIST_NAME variable contains the identifier name for your mailing list to be validated. FILE_PATH contains the path to the input CSV file containing the list of emails to be validated.<\/p>\n\n<h2 class=\"wp-block-heading\">Preparing your mailing list file<\/h2>\n\n<p class=\"wp-block-paragraph\">Now that the configuration script refers to a mailing list file path via the FILE_PATH variable, you need an actual mailing list with email addresses to validate. Create a file named <code>mailing_list.csv<\/code> in the <code>standalone_python_scripts directory<\/code> and paste in a few sample email addresses to start:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>email<br \/>dummy_email@dummydomain.com<br \/>test_email@testemaildomain.com<br \/>non_existent_email_id_123456789@gmail.com<br \/>hellojohnsemail123@gmail.com<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">The email addresses used here are not valid. You can add more valid or invalid ones in the same format with your own desired list of email addresses.<\/p>\n\n<h2 class=\"wp-block-heading\">Creating a bulk validation job<\/h2>\n\n<p class=\"wp-block-paragraph\">With the mailing list in place and the configuration for the validation process ready, it&rsquo;s time to set up a function to create a bulk email validation job with Mailgun.<\/p>\n\n<p class=\"wp-block-paragraph\">In the same directory, create a Python script file named <code>bulk_email_validation.py<\/code> and define a <code>create_bulk_validation_job<\/code> function that takes two parameters, <code>list_name<\/code> (name of the mailing list) and <code>file_path <\/code>(path to the file containing emails):<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    def create_bulk_validation_job(list_name, file_path):rn    &quot;&quot;&quot;rn    This function creates a bulk validation job using the Mailgun API.rnrn    :param list_name: The name of the mailing list for validation.rn    :param file_path: The path to the CSV file containing emails to validate.rn    :return: Response object containing the job details.rn    &quot;&quot;&quot;rn    url = f&quot;{MAILGUN_API_URL}\/{list_name}&quot;rnrn    try:rn        # Send a POST request with the file to Mailgun&#039;s APIrn        with open(file_path, &quot;rb&quot;) as file_data:rn            response = requests.post(rn                url, auth=(&quot;api&quot;, API_KEY), files={&quot;file&quot;: file_data}rn            )rnrn        # Check if the request was successfulrn        if response.status_code == 202:rn            logging.info(f&quot;Bulk validation job created successfully for {list_name}&quot;)rn        else:rn            logging.error(rn                f&quot;Error creating validation job: {response.status_code} {response.text}&quot;rn            )rnrn        return response.json()rnrn    except Exception as e:rn        logging.error(f&quot;An error occurred while creating bulk validation job: {str(e)}&quot;)rn        return Nonern\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">The function sends a POST request to Mailgun&rsquo;s API to initiate the bulk email validation process. The request includes the file of email addresses that need to be validated.<\/p>\n\n<h2 class=\"wp-block-heading\">Developing functions to check job status and download results<\/h2>\n\n<p class=\"wp-block-paragraph\">Now, write another function called <code>get_bulk_validation_status<\/code> in the same <code>bulk_email_validation.py<\/code> script that checks the status of the submitted validation job. The response includes a link to download the validation results in both CSV and JSON formats. In this tutorial, you&rsquo;ll use JSON to download and process the results further.<\/p>\n\n<p class=\"wp-block-paragraph\">To download the validation results, the <code>get_bulk_validation_status<\/code> function makes a call to another function named <code>download_validation_results<\/code>. The downloaded result is placed inside the <code>validation_results<\/code> directory in the form of a JSON file. Go ahead and create this directory inside the <code>standalone_python_scripts<\/code> directory, then paste the following code defining these two functions into <code>bulk_email_validation.py<\/code>:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    def get_bulk_validation_status(list_name):rn    &quot;&quot;&quot;rn    This function checks the status of a bulk validation job and downloads the validation results.rnrn    :param list_name: The name of the mailing list for which the status is being checked.rn    :return: Validation results or None in case of failure.rn    &quot;&quot;&quot;rn    url = f&quot;{MAILGUN_API_URL}\/{list_name}&quot;rnrn    try:rn        # Send a GET request to Mailgun&#039;s API to fetch the job statusrn        response = requests.get(url, auth=(&quot;api&quot;, API_KEY))rnrn        # Check if the request was successfulrn        if response.status_code == 200:rn            logging.info(f&quot;Successfully retrieved validation status for {list_name}&quot;)rnrn            # Parse the JSON responsern            result = response.json()rnrn            # Fetch the download URL for JSON resultsrn            download_url = result.get(&quot;download_url&quot;, {}).get(&quot;json&quot;)rn            if download_url:rn                # Fetch and return the validation resultsrn                return download_validation_results(download_url)rn            else:rn                logging.info(&quot;Download URL not available.&quot;)rn                return Nonernrn        else:rn            logging.error(rn                f&quot;Error fetching job status: {response.status_code} {response.text}&quot;rn            )rn            return Nonernrn    except Exception as e:rn        logging.error(rn            f&quot;An error occurred while fetching bulk validation status: {str(e)}&quot;rn        )rn        return Nonernrndef download_validation_results(download_url):rn    &quot;&quot;&quot;rn    This function downloads and processes the bulk validation results from the provided URL.rnrn    :param download_url: The URL to download the validation results in JSON format.rn    :return: Parsed results or None in case of failure.rn    &quot;&quot;&quot;rn    try:rn        response = requests.get(download_url)rnrn        # Check if the request was successfulrn        if response.status_code == 200:rn            logging.info(&quot;Successfully downloaded validation results.&quot;)rnrn            with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref:rn                validation_results_path = os.path.join(rn                    os.getcwd(), &quot;validation_results&quot;rn                )rn                zip_ref.extractall(path=validation_results_path)rnrn            with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref:rn                for file in zip_ref.namelist():rn                    if file.endswith(&quot;.json&quot;):rn                        with zip_ref.open(file) as json_file:rn                            validation_results = json.load(json_file)rnrn            # Process the results (handle invalid emails, etc.)rn            process_validation_results(validation_results)rnrn            return validation_resultsrnrn        else:rn            logging.error(rn                f&quot;Error downloading results: {response.status_code} {response.text}&quot;rn            )rn            return Nonernrn    except Exception as e:rn        logging.error(rn            f&quot;An error occurred while downloading validation results: {str(e)}&quot;rn        )rn        return Nonern\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">The function sends a POST request to Mailgun&rsquo;s API to initiate the bulk email validation process. The request includes the file of email addresses that need to be validated.<\/p>\n\n<h2 class=\"wp-block-heading\">Developing functions to check job status and download results<\/h2>\n\n<p class=\"wp-block-paragraph\">Now, write another function called <code>get_bulk_validation_status<\/code> in the same <code>bulk_email_validation.py<\/code> script that checks the status of the submitted validation job. The response includes a link to download the validation results in both CSV and JSON formats. In this tutorial, you&rsquo;ll use JSON to download and process the results further.<\/p>\n\n<p class=\"wp-block-paragraph\">To download the validation results, the <code>get_bulk_validation_status<\/code> function makes a call to another function named <code>download_validation_results<\/code>. The downloaded result is placed inside the <code>validation_results<\/code> directory in the form of a JSON file. Go ahead and create this directory inside the <code>standalone_python_scripts<\/code> directory, then paste the following code defining these two functions into <code>bulk_email_validation.py<\/code>: <\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    def get_bulk_validation_status(list_name):rn    &quot;&quot;&quot;rn    This function checks the status of a bulk validation job and downloads the validation results.rnrn    :param list_name: The name of the mailing list for which the status is being checked.rn    :return: Validation results or None in case of failure.rn    &quot;&quot;&quot;rn    url = f&quot;{MAILGUN_API_URL}\/{list_name}&quot;rnrn    try:rn        # Send a GET request to Mailgun&#039;s API to fetch the job statusrn        response = requests.get(url, auth=(&quot;api&quot;, API_KEY))rnrn        # Check if the request was successfulrn        if response.status_code == 200:rn            logging.info(f&quot;Successfully retrieved validation status for {list_name}&quot;)rnrn            # Parse the JSON responsern            result = response.json()rnrn            # Fetch the download URL for JSON resultsrn            download_url = result.get(&quot;download_url&quot;, {}).get(&quot;json&quot;)rn            if download_url:rn                # Fetch and return the validation resultsrn                return download_validation_results(download_url)rn            else:rn                logging.info(&quot;Download URL not available.&quot;)rn                return Nonernrn        else:rn            logging.error(rn                f&quot;Error fetching job status: {response.status_code} {response.text}&quot;rn            )rn            return Nonernrn    except Exception as e:rn        logging.error(rn            f&quot;An error occurred while fetching bulk validation status: {str(e)}&quot;rn        )rn        return Nonernrndef download_validation_results(download_url):rn    &quot;&quot;&quot;rn    This function downloads and processes the bulk validation results from the provided URL.rnrn    :param download_url: The URL to download the validation results in JSON format.rn    :return: Parsed results or None in case of failure.rn    &quot;&quot;&quot;rn    try:rn        response = requests.get(download_url)rnrn        # Check if the request was successfulrn        if response.status_code == 200:rn            logging.info(&quot;Successfully downloaded validation results.&quot;)rnrn            with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref:rn                validation_results_path = os.path.join(rn                    os.getcwd(), &quot;validation_results&quot;rn                )rn                zip_ref.extractall(path=validation_results_path)rnrn            with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref:rn                for file in zip_ref.namelist():rn                    if file.endswith(&quot;.json&quot;):rn                        with zip_ref.open(file) as json_file:rn                            validation_results = json.load(json_file)rnrn            # Process the results (handle invalid emails, etc.)rn            process_validation_results(validation_results)rnrn            return validation_resultsrnrn        else:rn            logging.error(rn                f&quot;Error downloading results: {response.status_code} {response.text}&quot;rn            )rn            return Nonernrn    except Exception as e:rn        logging.error(rn            f&quot;An error occurred while downloading validation results: {str(e)}&quot;rn        )rn        return Nonern\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<h2 class=\"wp-block-heading\">Parsing and handling validation results<\/h2>\n\n<p class=\"wp-block-paragraph\">Once you&rsquo;ve downloaded and gotten access to the validation results, you need to parse and process them. This step is crucial for identifying deliverable and undeliverable emails.<\/p>\n\n<p class=\"wp-block-paragraph\">Paste the following code to define the function in <code>bulk_email_validation.py<\/code> that does this described task:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    def process_validation_results(results):rn    &quot;&quot;&quot;rn    This function processes the validation results and handles invalid and risky emails.rnrn    :param results: The JSON object containing the validation results.rn    &quot;&quot;&quot;rn    try:rn        count_of_deliverable_addresses: int = 0rn        emails_tobe_verified = set()rnrn        # Extract the results summaryrn        logging.info(f&quot;Total email addresses validated: {len(results)}&quot;)rnrn        for result in results:rn            # Access data within each dictionaryrn            deliverable = (rn                result[&quot;result&quot;] == &quot;deliverable&quot;rn            )  # Check if result is deliverablern            undeliverable = result[&quot;result&quot;] != &quot;deliverable&quot;rn            risk = result[&quot;risk&quot;]rnrn            # Count the number of deliverable addressesrn            if deliverable:rn                count_of_deliverable_addresses += 1rnrn            # Count the number of undeliverable addresses and add them to the list for verificationrn            if undeliverable:rn                emails_tobe_verified.add(result[&quot;address&quot;])rnrn            # Count the number of risky addresses and add them to the list for verificationrn            if risk != &quot;low&quot;:rn                emails_tobe_verified.add(result[&quot;address&quot;])rnrn        # Log the results summaryrn        logging.info(f&quot;Found {count_of_deliverable_addresses} deliverable emails&quot;)rnrn        if len(emails_tobe_verified) &gt; 0:rn            logging.warning(rn                &quot;Found some emails that need to be verified because of its risky or undeliverable state.&quot;rn            )rn            logging.warning(rn                &quot;Total emails to be verified: {}&quot;.format(len(emails_tobe_verified))rn            )rn            logging.warning(f&quot;Emails to be verified: {&#039;, &#039;.join(emails_tobe_verified)}&quot;)rnrn    except Exception as e:rn        logging.error(rn            f&quot;An error occurred while processing validation results: {str(e)}&quot;rn        )rn\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<p class=\"wp-block-paragraph\">Now, define the instructions to call these functions with the following code:<\/p>\n    <div data-content-type=\"longform\" class=\"code-snippet longform-spacings rounded-lg overflow-hidden shadow \" data-count=\"1\">\r\n        <ul class=\"nav nav-buttons code-snippet__tabs longform-except position-relative d-flex gap-2 flex-wrap p-3\" role=\"tablist\">\r\n\r\n                            \r\n                    \r\n                        <li class=\"nav-item\" role=\"presentation\">\r\n                            <button class=\"nav-link active\" data-bs-toggle=\"tab\" data-bs-target=\"#code_0\" type=\"button\" role=\"tab\" aria-controls=\"code_0\" aria-selected=\"true\">\r\n                                Python                            <\/button>\r\n                        <\/li>\r\n\r\n                    \r\n                            \r\n        <\/ul>\r\n        <div class=\"code-snippet__tab-content tab-content\">\r\n\r\n                            \r\n                    <div class=\"tab-pane show active\" id=\"code_0\" role=\"tabpanel\" aria-labelledby=\"code_0\">\r\n                        <div class=\"code-snippet__code-wrapper\">\r\n                            <div class=\"nav nav-buttons code-snippet__copy-wrapper\">\r\n                                <button type=\"button\" class=\"nav-link code-snippet__copy\" data-clipboard-target=\"#code_0_content\" data-clipboard-label=\"Copier dans le presse-papiers\" data-clipboard-success-label=\"Copi\u00e9\u00a0!\" data-clipboard-error-label=\"Impossible de copier\" data-tooltip=\"Copier dans le presse-papiers\" data-tooltip-placement=\"left\" role=\"tooltip\" aria-label=\"Copier dans le presse-papiers\">\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--default\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/file-stack.svg\"><\/svg>\r\n                                    <svg class=\"code-snippet__copy-icon code-snippet__copy-icon--success\" width=\"24\" height=\"24\" aria-hidden=\"true\" data-url=\"https:\/\/www.mailgun.com\/wp-content\/plugins\/sinch-core\/assets\/icons\/sinch\/badge-check.svg\"><\/svg>\r\n                                <\/button>\r\n                            <\/div>\r\n                            <pre class=\"w-100 h-100 m-0 line-numbers language-Python\">\r\n                                <code id=\"code_0_content\" class=\"language-Python\">\r\n\r\n                                    if __name__ == &quot;__main__&quot;:rnrn    if COMMAND == &quot;submit_job&quot;:rn        create_bulk_validation_job(LIST_NAME, FILE_PATH)rn    elif COMMAND == &quot;get_job_status&quot;:rn        get_bulk_validation_status(LIST_NAME)rn    else:rn        logging.error(&quot;Invalid command. Please use &#039;submit_job&#039; or &#039;get_job_status&#039;.&quot;)rn\r\n                                <\/code>\r\n                            <\/pre>\r\n                        <\/div>\r\n                    <\/div>\r\n                                    <\/div>\r\n    <\/div>\r\n\n<h2 class=\"wp-block-heading\">The final script<\/h2>\n\n<p class=\"wp-block-paragraph\">Overall, the entire <code>bulk_email_validation.py<\/code> script does the heavy lifting of posting a bulk email validation request, querying the status of the submitted validation job request, and processing the results. Once you&rsquo;re done with all changes, your <code>bulk_email_validation.py<\/code> script should look like <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/standalone_python_scripts\/bulk_email_validation.py\" target=\"_tabs\" rel=\"noopener noreferrer\">this<\/a>.<\/p>\n\n<p class=\"wp-block-paragraph\">Throughout the script, the use of try&#8230;except blocks ensures any errors during the API calls are handled. This is especially important for production environments where unexpected issues can arise, like when your application is unable to reach the Mailgun service&rsquo;s endpoints or when you&rsquo;re trying to submit a validation job request with the same list name. The error messages and the comments in the source code help explain the various other scenarios that are handled.<\/p>\n\n<p class=\"wp-block-paragraph\">If you&rsquo;re resubmitting the validation job request with the same list name (you&rsquo;ll learn how to execute the script in the following sections), the script is equipped to handle such scenarios as well by throwing the corresponding error message with a description:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 07:34:39,081 - ERROR - create_bulk_validation_job - Error creating validation job: 409 {\"message\":\"List already exists.\"}<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">If you encounter a network error between your application and the Mailgun service, you can implement a retry mechanism. You can either create your own or use a library like <a href=\"https:\/\/tenacity.readthedocs.io\/en\/latest\/\" target=\"_tabs\" rel=\"noopener noreferrer\">tenacity<\/a> to define how many times to retry the request if it fails due to temporary connectivity issues. You can also implement other error handling scenarios as your project or business demands.<\/p>\n\n<p class=\"wp-block-paragraph\">At this point, you&rsquo;ve finished setting up the project, and it&rsquo;s time to execute it.<\/p>\n\n<h2 class=\"wp-block-heading\">Testing by submitting a bulk email validation job request<\/h2>\n\n<p class=\"wp-block-paragraph\">To execute the script to submit the bulk validation job request, open a terminal and switch to the <code>standalone_python_scripts<\/code> directory. Execute the following command:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>python bulk_email_validation.py<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">You should see an output indicating that the job request has been successfully submitted to the Mailgun service:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:47:34,012 - INFO - create_bulk_validation_job - Bulk validation job created successfully for bulk_mailing_list_validation_1<\/code><\/p>\n\n<h2 class=\"wp-block-heading\">Testing by fetching the status of the bulk email validation job<\/h2>\n\n<p class=\"wp-block-paragraph\">At times, based on the volume of email addresses to be validated, the submitted job will take varying times to complete. To get the status of the job request and to process the results if the request is complete, edit the config.py code to update the COMMAND configuration to the value <code>get_job_status<\/code>. Once done, execute the following command to carry out this task:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>python bulk_email_validation.py<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">You should see an output indicating that the validation job is complete, the results are downloaded, and then processed:<\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:07,723 - INFO - get_bulk_validation_status - Successfully retrieved validation status for bulk_mailing_list_validation_1<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,375 - INFO - download_validation_results - Successfully downloaded validation results.<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,378 - INFO - process_validation_results - Total email addresses validated: 191<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,378 - INFO - process_validation_results - Found 178 deliverable emails<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,378 - WARNING - process_validation_results - Found some emails that need to be verified because of its risky or undeliverable state.<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,378 - WARNING - process_validation_results - Total emails to be verified: 13<\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>2024-09-28 19:48:08,378 - WARNING - process_validation_results - Emails to be verified: <\/code><\/p>\n\n<p class=\"wp-block-paragraph\"><code>dummy_email@dummydomain1.com, dummy_email@dummydomain2.com, hellojohnsemail123@gmail.com, dummy_email@dummydomain3.com, non_existent_email_id_123456789@gmail.com, dummy_email@dummydomain.com, dummy_email@dummydomain4.com, dummy_email@dummydomain5.com, dummy_email@dummydomain6.com, dummy_email@dummydomain7.com, dummy_email@dummydomain8.com, test_email@testemaildomain.com, electronix84@gmail.com<\/code><\/p>\n\n<p class=\"wp-block-paragraph\">This output indicates that out of 191 email addresses submitted for validation, 178 are categorized as deliverable, and the remaining 13 are not.<\/p>\n\n<p class=\"wp-block-paragraph\">The script identifies the email addresses to be verified by parsing the response from Mailgun APIs and displaying the list in the output. It&rsquo;s now up to you to decide what course of action to take based on your project or business needs.<\/p>\n\n<h2 class=\"wp-block-heading\">Integrating bulk email validation in a Django application<\/h2>\n\n<p class=\"wp-block-paragraph\">Now that you&rsquo;ve learned these techniques, you can opt to apply them in your Django application by creating endpoints to upload a mailing list with bulk email addresses and validating them.<\/p>\n\n<p class=\"wp-block-paragraph\">You can refer to or clone <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python.git\" target=\"_tabs\" rel=\"noopener noreferrer\">this GitHub repository<\/a> if you want to experiment and follow along. The bulk_email_validation directory holds the Django project&rsquo;s source code. The following are the key files involved in this project:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>The <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/requirements.txt\" target=\"_tabs\" rel=\"noopener noreferrer\">requirements.txt file<\/a> contains the dependencies required for this Django project.<\/li>\n\n\n\n<li>The <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/bulk_email_validation\/app\/config.py\" target=\"_tabs\" rel=\"noopener noreferrer\">config.py file<\/a> holds the configuration related to the Mailgun service.<\/li>\n\n\n\n<li>The <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/bulk_email_validation\/app\/views.py\" target=\"_tabs\" rel=\"noopener noreferrer\">views.py file<\/a> contains the logic to process the request and responses related to bulk email validation endpoints.<\/li>\n\n\n\n<li>The <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/bulk_email_validation\/app\/serializers.py\" target=\"_tabs\" rel=\"noopener noreferrer\">serializers.py file<\/a> contains classes that help translate data between Python objects and formats like JSON, making it easy to send or receive data for bulk email validation APIs with just a few lines of code.<\/li>\n\n\n\n<li>The <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/blob\/main\/bulk_email_validation\/urls.py\" target=\"_tabs\" rel=\"noopener noreferrer\">urls.py file<\/a> contains the two endpoints related to bulk email validation. One endpoint is for submitting the bulk email validation job request; the other is for getting the status and processing the results.<\/li>\n<\/ul>\n\n<p class=\"wp-block-paragraph\">The screenshots below are intended to help you understand the endpoints that this Django application deals with and the output it can generate.<\/p>\n\n<p class=\"wp-block-paragraph\">The first screenshot indicates the POST request with options to upload the mailing list file and set a mailing list name, along with the response received after the successful submission of the bulk email validation job request:<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4082\" width=\"1980\" height=\"892\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM.png\" alt=\"validation job response after its completion:\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM.png 1980w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM-300x135.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM-768x346.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM-1024x461.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.13_AM-1536x692.png 1536w\" sizes=\"(max-width: 1980px) 100vw, 1980px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">The second screenshot indicates the successful retrieval of the validation job response after its completion:<\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-4083\" width=\"1964\" height=\"1156\" src=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM.png\" alt=\"POST request  Screen\" srcset=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM.png 1964w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM-300x177.png 300w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM-768x452.png 768w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM-1024x603.png 1024w, https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/Screenshot_2025-01-07_at_10.19.20_AM-1536x904.png 1536w\" sizes=\"(max-width: 1964px) 100vw, 1964px\" \/><\/figure>\n\n<p class=\"wp-block-paragraph\">You can have a frontend application developed with any frontend technology that you wish and call these Django application endpoints to meet your bulk email validation goal.<\/p>\n\n<h2 class=\"wp-block-heading\">Wrapping up<\/h2>\n\n<p class=\"wp-block-paragraph\">This tutorial taught you how to integrate Mailgun&rsquo;s Bulk Email Validation API into your Python applications to ensure the accuracy and deliverability of your email lists. From setting up your Mailgun account, obtaining the API key, and securely handling it, to implementing bulk validation, sending POST and GET requests, and processing the results, you now know how to automate the email verification process. You also explored how to manage invalid emails, handle common errors, and integrate email validation into larger web applications like Django. The entire source code presented for this tutorial is available in <a href=\"https:\/\/github.com\/rajkumarvenkatasamy\/bulk-email-validation-using-mailgun-and-python\/tree\/main\" target=\"_tabs\" rel=\"noopener noreferrer\">this GitHub repo<\/a>.<\/p>\n\n<p class=\"wp-block-paragraph\">By following these steps, you can effectively identify deliverable emails from your large mailing list, thus improving the quality of your email campaigns, reducing bounce rates, and safeguarding your sender reputation. Using Mailgun&rsquo;s powerful Bulk Email Validation API not only streamlines this process but also ensures your email delivery is more reliable and efficient. As you continue to optimize your email strategy, check out <a href=\"https:\/\/www.mailgun.com\/fr\/\" target=\"_tabs\" rel=\"noopener noreferrer\">Mailgun<\/a>, explore its various product offerings, and utilize them to further enhance your email campaigns and maximize their impact.<\/p>\n\r\n    <aside data-content-type=\"longform\"  class=\"banner-block longform-spacings rounded-lg shadow-lg px-5 py-6 px-md-6 py-md-7 p-lg-7 bg-light\" data-theme=\"dark\" aria-labelledby=\"banner-block-block_e5ae78133c4e83b378c197cb21378f2b\">\r\n                            <p class=\"h4 text-accent fw-bold\" id=\"banner-block-block_e5ae78133c4e83b378c197cb21378f2b\">\r\n                Get expert advice            <\/p>\r\n                            <div class=\"mb-0 text-body-color\">\r\n                                    <div class=\"content-body mb-0 text-body-color\">Deliverability does require a certain level of competency. If you need guidance navigating the complexities of inbox placement, ask about Sinch Mailgun\u2019s Deliverability Services. We provide dedicated technical experts, regular reporting, custom deliverability strategies, and access to helpful tools.<\/div>\r\n                            <\/div>\r\n        \r\n        <div class=\"text-start mt-5\"><a href=\"https:\/\/www.mailgun.com\/fr\/solutions\/services-delivrabilite-lp\/\"  class=\"btn btn-secondary\" >Talk to a strategist<\/a><\/div>\r\n    <\/aside>\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>Apprenez \u00e0 int\u00e9grer l&rsquo;API de validation des emails en masse de Mailgun avec Python. Ce guide couvre la configuration, l&rsquo;utilisation s\u00e9curis\u00e9e de l&rsquo;API et la v\u00e9rification efficace des listes de contacts.<\/p>\n","protected":false},"author":19,"featured_media":3952,"menu_order":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"blog_category":[19],"class_list":["post-19993","blog","type-blog","status-publish","has-post-thumbnail","hentry","blog_category-dev-life"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>V\u00e9rifier des emails avec Python et l&#039;API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun<\/title>\n<meta name=\"description\" content=\"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l&#039;API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"V\u00e9rifier des emails avec Python et l&#039;API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun\" \/>\n<meta property=\"og:description\" content=\"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l&#039;API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Transactional Email API Service For Developers | Mailgun\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-14T22:52:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-Dev-Life.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"448\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/\",\"name\":\"V\u00e9rifier des emails avec Python et l'API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-Dev-Life.png\",\"datePublished\":\"2025-01-07T00:00:00+00:00\",\"dateModified\":\"2026-09-14T22:52:51+00:00\",\"description\":\"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l'API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-Dev-Life.png\",\"contentUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/MG-Blog-Dev-Life.png\",\"width\":720,\"height\":448},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/dev-life\\\/verifier-emails-python-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"V\u00e9rifier des emails avec Python 3.9+ et l\u2019API de Mailgun\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/\",\"name\":\"Transactional Email API Service For Developers | Mailgun\",\"description\":\"Des API d\u2019emails transactionnels puissantes qui vous permettent d'envoyer, de recevoir et de suivre des emails, con\u00e7ues pour les d\u00e9veloppeurs. En savoir plus d\u00e8s aujourd'hui !\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#organization\",\"name\":\"Transactional Email API Service For Developers | Mailgun\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-android-chrome-512x512-1.png\",\"contentUrl\":\"https:\\\/\\\/www.mailgun.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-android-chrome-512x512-1.png\",\"width\":512,\"height\":512,\"caption\":\"Transactional Email API Service For Developers | Mailgun\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mailgun.com\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"V\u00e9rifier des emails avec Python et l'API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun","description":"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l'API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/","og_locale":"fr_FR","og_type":"article","og_title":"V\u00e9rifier des emails avec Python et l'API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun","og_description":"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l'API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.","og_url":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/","og_site_name":"Transactional Email API Service For Developers | Mailgun","article_modified_time":"2026-09-14T22:52:51+00:00","og_image":[{"width":720,"height":448,"url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-Dev-Life.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/","url":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/","name":"V\u00e9rifier des emails avec Python et l'API de Mailgun\u00a0: guide \u00e9tape par \u00e9tape - Transactional Email API Service For Developers | Mailgun","isPartOf":{"@id":"https:\/\/www.mailgun.com\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/#primaryimage"},"image":{"@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-Dev-Life.png","datePublished":"2025-01-07T00:00:00+00:00","dateModified":"2026-09-14T22:52:51+00:00","description":"Les emails non valides peuvent nuire \u00e0 votre r\u00e9putation. Apprenez \u00e0 utiliser Python 3.9+ et l'API de validation des emails en masse de Mailgun pour v\u00e9rifier vos listes de contacts, am\u00e9liorer la d\u00e9livrabilit\u00e9 et prot\u00e9ger la r\u00e9putation de votre domaine.","breadcrumb":{"@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/#primaryimage","url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-Dev-Life.png","contentUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/07\/MG-Blog-Dev-Life.png","width":720,"height":448},{"@type":"BreadcrumbList","@id":"https:\/\/www.mailgun.com\/fr\/blog\/dev-life\/verifier-emails-python-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mailgun.com\/fr\/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https:\/\/www.mailgun.com\/fr\/blog\/"},{"@type":"ListItem","position":3,"name":"V\u00e9rifier des emails avec Python 3.9+ et l\u2019API de Mailgun"}]},{"@type":"WebSite","@id":"https:\/\/www.mailgun.com\/fr\/#website","url":"https:\/\/www.mailgun.com\/fr\/","name":"Transactional Email API Service For Developers | Mailgun","description":"Des API d\u2019emails transactionnels puissantes qui vous permettent d'envoyer, de recevoir et de suivre des emails, con\u00e7ues pour les d\u00e9veloppeurs. En savoir plus d\u00e8s aujourd'hui !","publisher":{"@id":"https:\/\/www.mailgun.com\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mailgun.com\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/www.mailgun.com\/fr\/#organization","name":"Transactional Email API Service For Developers | Mailgun","url":"https:\/\/www.mailgun.com\/fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mailgun.com\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/06\/cropped-android-chrome-512x512-1.png","contentUrl":"https:\/\/www.mailgun.com\/wp-content\/uploads\/2025\/06\/cropped-android-chrome-512x512-1.png","width":512,"height":512,"caption":"Transactional Email API Service For Developers | Mailgun"},"image":{"@id":"https:\/\/www.mailgun.com\/fr\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/blog\/19993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/users\/19"}],"version-history":[{"count":3,"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/blog\/19993\/revisions"}],"predecessor-version":[{"id":20225,"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/blog\/19993\/revisions\/20225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/media\/3952"}],"wp:attachment":[{"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/media?parent=19993"}],"wp:term":[{"taxonomy":"blog_category","embeddable":true,"href":"https:\/\/www.mailgun.com\/fr\/wp-json\/wp\/v2\/blog_category?post=19993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}