// transactional email
Via APITwilio SendGrid email verification with pingutil
SendGrid delivers whatever address your app hands it, so a typo or throwaway at signup becomes a bounce or a wasted send on your sender reputation. Check the address with pingutil before the first Mail Send call, and use SendGrid's Event Webhook to flag users whose mail bounces so they can fix their address.
Where it connects: Your signup code before Mail Send, plus the SendGrid Event Webhook (bounce and dropped events)
What goes wrong without it
- Our bounce rate in SendGrid creeps up every month and most of it is signups who typed their address wrong.
- Once an address bounces, SendGrid puts it on the bounce suppression list and drops every future email to it, including password resets, and the user has no idea why.
- Temp-mail accounts sign up, get the verification email, claim the trial credits and never come back.
What you can do with Twilio SendGrid and pingutil
Verify before the first Mail Send
Call /v1/verify when the user submits the signup form. Reject invalid addresses, show did_you_mean when it is set, and only then send the confirmation email through SendGrid.
Block throwaway signups before they cost you a send
A disposable domain returns status invalid with reason disposable_domain, so the signup never reaches SendGrid and never claims a trial.
Re-check the new address after a bounce
When the Event Webhook reports a bounce for a user, mark their email as bouncing and ask them to update it. Verify the replacement with pingutil before you remove the old entry or send again.
Set it up
- 1
Create a pingutil API key in the dashboard and store it as PINGUTIL_KEY next to your SENDGRID_API_KEY.
- 2
In your signup handler, call POST https://pingutil.com/v1/verify with the address and a timeout, before calling SendGrid.
- 3
Reject status invalid, offer did_you_mean, and let risky and unknown addresses through with a flag on the user record.
- 4
Send the confirmation or welcome email with @sendgrid/mail as usual.
- 5
Enable the Event Webhook in SendGrid and handle bounce and dropped events by flagging the user's email so your app can ask for a new one.
import sgMail from '@sendgrid/mail';
sgMail.setApiKey(process.env.SENDGRID_API_KEY!);
type Verification = { status: 'valid' | 'invalid' | 'risky' | 'unknown'; reason: string; did_you_mean: string | null };
async function verify(email: string): Promise<Verification | null> {
try {
const res = await fetch('https://pingutil.com/v1/verify', {
method: 'POST',
headers: { authorization: 'Bearer ' + process.env.PINGUTIL_KEY, 'content-type': 'application/json' },
body: JSON.stringify({ email }),
signal: AbortSignal.timeout(8000), // slow mail servers can take much longer; don't block signup on them
});
if (!res.ok) return null; // 429 quota_exceeded, 5xx: fail open
return (await res.json()) as Verification;
} catch {
return null; // timeout or network error: fail open
}
}
export async function signUp(email: string) {
const v = await verify(email);
if (v?.status === 'invalid') {
return { ok: false, error: v.did_you_mean ? 'Did you mean ' + v.did_you_mean + '?' : 'This email address cannot receive mail.' };
}
// risky / unknown / null: allow, but remember it for later decisions
const user = await createUser({ email, emailCheck: v?.status ?? 'unchecked' });
await sgMail.send({
to: email,
from: 'hello@yourapp.com',
subject: 'Confirm your email',
text: 'Click to confirm: https://yourapp.com/confirm?token=' + user.confirmToken,
});
return { ok: true };
}
declare function createUser(u: { email: string; emailCheck: string }): Promise<{ confirmToken: string }>;What to do with each result
| pingutil result | Action in Twilio SendGrid |
|---|---|
| status invalid, reason mailbox_not_found or no_mx | Do not call Mail Send. Ask the user for another address. |
| did_you_mean set (for example jane@gmail.com) | Show the suggestion before creating the account, so the first SendGrid email goes to the right inbox. |
| status invalid, reason disposable_domain | Refuse the signup or withhold trial credits. No SendGrid send happens. |
| status risky, reason accept_all | Send, but watch the Event Webhook for a bounce on this user. |
| status unknown or no response | Send as normal and keep the user flagged as unchecked. |
Limits to plan for
- SendGrid also sells its own Email Address Validation API, with real-time and bulk options. Teams use pingutil at the point of capture when they also want disposable, free-webmail and work-email classification and company data from the same call, or want one verifier across several sending tools.
- The Event Webhook posts events in batches as a JSON array, so your handler must loop over every event. Bounce events are permanent denials; blocked events are temporary and arrive as type blocked on a bounce event.
- Mailbox checks can take seconds on slow servers and can't confirm catch-all domains. Use a short timeout at signup and treat unknown as allowed.
Twilio SendGrid documentation
- www.twilio.com/docs/sendgrid/for-developers/tracking-events/event
- www.twilio.com/docs/sendgrid/ui/managing-contacts/email-address-validation
Twilio SendGrid is a trademark of its owner. This integration uses Twilio SendGrid's documented extension points; it is not an official Twilio SendGrid app.
Common questions
- Why verify with pingutil if SendGrid has its own validation?
- You don't have to. Some teams prefer one verifier for every channel (signup, CRM, marketing tool), or want the disposable and work-email category from the same response. Both approaches check before sending.
- Does pingutil send an email to check the address?
- No. It asks the recipient's mail server whether the mailbox exists with an SMTP RCPT TO check and stops before any message is sent.
- What should I do with addresses already on my SendGrid bounce list?
- Leave them suppressed. If the user gives you a new address, verify it with pingutil and update their record instead of removing the old bounce.
Stop bad addresses in Twilio SendGrid 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 Twilio SendGrid setup will receive.