Skip to content

// transactional email

Via API

Mailjet email verification with pingutil

Mailjet reports a bounce or blocked event after the fact, when your sender reputation has already taken the hit. Verifying the recipient with pingutil before the Send API call stops most invalid and disposable addresses up front, and Mailjet's event webhooks catch the rest.

Where it connects: Your code before the Send API v3.1, plus Mailjet event webhooks (bounce, blocked)

What goes wrong without it

  • Our Mailjet stats show a steady stream of bounce events from signups that never confirmed.
  • Users register with addresses at domains that do not even have an MX record, and we still try to send.
  • We don't know which users in our database have a working address and which ones Mailjet has been blocking for months.

What you can do with Mailjet and pingutil

  • Verify before the Send API call

    Call /v1/verify in the code that sends account emails, and skip the Mailjet send when the address is invalid.

  • Reject domains that cannot receive mail

    Addresses at domains with no MX return status invalid with reason no_mx or no_domain, so they never become Mailjet recipients.

  • Sync bounce and blocked events to user records

    Point Mailjet's event webhook at your app for bounce and blocked events, and flag the matching users so support and your app see it.

Set it up

  1. 1

    Store PINGUTIL_KEY with your Mailjet API key and secret.

  2. 2

    Call pingutil /v1/verify before POST https://api.mailjet.com/v3.1/send.

  3. 3

    Skip invalid addresses and send to the rest.

  4. 4

    In Mailjet's event notification settings, add your endpoint URL for the bounce and blocked events.

  5. 5

    Flag users from those events and verify any replacement address before you send again.

Python: verify, then call the Mailjet Send API v3.1
import os
import requests

MJ_AUTH = (os.environ["MJ_APIKEY_PUBLIC"], os.environ["MJ_APIKEY_PRIVATE"])


def verify(email: str):
    try:
        r = requests.post(
            "https://pingutil.com/v1/verify",
            headers={"Authorization": "Bearer " + os.environ["PINGUTIL_KEY"]},
            json={"email": email},
            timeout=10,
        )
        return r.json() if r.status_code == 200 else None
    except requests.RequestException:
        return None  # fail open


def send_welcome(email: str, name: str) -> str:
    v = verify(email)
    if v and v["status"] == "invalid":
        return "skipped:" + v["reason"]  # e.g. no_mx, mailbox_not_found, disposable_domain

    r = requests.post(
        "https://api.mailjet.com/v3.1/send",
        auth=MJ_AUTH,
        json={
            "Messages": [
                {
                    "From": {"Email": "hello@yourapp.com", "Name": "YourApp"},
                    "To": [{"Email": email, "Name": name}],
                    "Subject": "Welcome to YourApp",
                    "TextPart": "Thanks for signing up.",
                }
            ]
        },
        timeout=15,
    )
    r.raise_for_status()
    return "sent"

What to do with each result

pingutil resultAction in Mailjet
status invalid, reason no_mx or no_domainDo not send. The domain cannot receive mail.
status invalid, reason mailbox_not_foundDo not send; ask the user for another address.
checks.free_provider trueNo action for transactional mail; useful if you route B2B signups differently.
status risky or unknownSend, and watch for a bounce or blocked event on that address.

Limits to plan for

  • Mailjet's event webhooks cover open, click, bounce, spam, blocked, unsub and sent. Only bounce and blocked matter for cleaning addresses.
  • pingutil's default budget is 300 verified addresses a day (3,000 a month) per account. If you need more for a backlog, verify new addresses first and the backlog over several days. Those are Free plan limits; Enterprise has custom limits.
  • A valid result means the mail server accepted the recipient at check time. It does not predict spam-folder placement.

Mailjet documentation

Mailjet is a trademark of its owner. This integration uses Mailjet's documented extension points; it is not an official Mailjet app.

Common questions

Should I verify before every Mailjet send?
No. Verify when the address is first stored or changed, save the status on the user, and send from then on. Re-check only addresses that bounce.
What does pingutil do with Yahoo and other accept-everything providers?
They come back risky with reason accept_all, because the server says yes to every address. Send to them, but do not treat them as confirmed.

Stop bad addresses in Mailjet today

Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your Mailjet setup will receive.