Why You Shouldn't Just "Send"⚠️
Let’s start with the problem. Many developers build scripts that send emails directly — without verifying if the address is even real. This might seem harmless at first, but over time, it causes serious issues:
- High bounce rates: Emails sent to fake or mistyped addresses won’t go through. A high bounce rate signals to providers that you're a spam risk.
- Wasted resources: Your system spends time and processing power trying to deliver undeliverable messages.
- Damaged sender reputation: Internet Service Providers (ISPs) track your domain's behavior. Sending to invalid addresses frequently can get you blacklisted.
- Spam folder trouble: Even your valid recipients may stop seeing your emails because providers begin flagging you.
✅ Best practice: Always verify your email list before sending. And that’s where AbstractAPI steps in.

✅ Step 1: Validate Emails with AbstractAPI
Let’s first make sure our emails are legitimate and deliverable. AbstractAPI's Email Validation API gives us real-time feedback on an email address’s status — checking syntax, domain, and even whether the mailbox exists using SMTP checks.
🔌 How it Works
Here’s a Python function that sends a request to AbstractAPI and determines if an email is valid:
import requests
ABSTRACTAPI_KEY = 'your_abstractapi_key_here'
def is_email_valid(email):
url = f"https://emailvalidation.abstractapi.com/v1/?api_key={ABSTRACTAPI_KEY}&email={email}"
response = requests.get(url)
data = response.json()
# Check if SMTP and deliverability checks passed
smtp_valid = data.get("is_smtp_valid", "FALSE")
deliverability = data.get("deliverability", "UNDELIVERABLE")
return smtp_valid == "TRUE" and deliverability == "DELIVERABLE"
🔍 What This Does
- Calls AbstractAPI’s validation endpoint with the email you want to check.
- Parses the response for two key fields:
- is_smtp_valid: Whether the mailbox exists and accepts messages.
- deliverability: AbstractAPI’s overall rating based on multiple factors.
- Returns True only if both indicate the email is likely to be successfully delivered.
🛡️ Why it matters: This tiny check protects your domain, improves deliverability, and keeps your email campaigns clean and effective.
Want to explore more validation capabilities? Check out our full Email Verification Guide.
📤 Step 2: Sending Emails with Python's smtplib
Now that we’ve cleaned up our list, let’s look at how to send an email using Python’s standard libraries.
Python includes two helpful modules for sending emails: smtplib (for sending) and email.message (for formatting). Together, they let you craft and dispatch messages with minimal setup.
✉️ Basic Example:
import smtplib
from email.message import EmailMessage
def send_email(sender, recipient, subject, body, smtp_server, smtp_port, login, password):
msg = EmailMessage()
msg["From"] = sender
msg["To"] = recipient
msg["Subject"] = subject
msg.set_content(body)
# Connect to SMTP server and send the email
with smtplib.SMTP_SSL(smtp_server, smtp_port) as server:
server.login(login, password)
server.send_message(msg)
🛠️ What You’ll Need
- SMTP credentials: For example, Gmail requires you to enable App Passwords if you use 2FA.
- Server details: For Gmail, use smtp.gmail.com and port 465 (SSL).
- Basic message data: From, to, subject, and body.
🧩 Step 3: Put It All Together – Validate & Send
Here’s a complete script that:
- Loops through a list of emails.
- Validates each one.
- Sends only to the verified addresses.
import smtplib
import requests
from email.message import EmailMessage
ABSTRACTAPI_KEY = 'your_abstractapi_key_here'
def is_email_valid(email):
url = f"https://emailvalidation.abstractapi.com/v1/?api_key={ABSTRACTAPI_KEY}&email={email}"
response = requests.get(url)
data = response.json()
smtp_valid = data.get("is_smtp_valid", "FALSE")
deliverability = data.get("deliverability", "UNDELIVERABLE")
return smtp_valid == "TRUE" and deliverability == "DELIVERABLE"
def send_email(sender, recipient, subject, body, smtp_server, smtp_port, login, password):
msg = EmailMessage()
msg["From"] = sender
msg["To"] = recipient
msg["Subject"] = subject
msg.set_content(body)
with smtplib.SMTP_SSL(smtp_server, smtp_port) as server:
server.login(login, password)
server.send_message(msg)
# Your email list
email_list = ["valid@example.com", "fake@nowhere.com"]
# Email credentials and message
smtp_server = "smtp.gmail.com"
smtp_port = 465
sender_email = "your_email@gmail.com"
password = "your_app_password"
subject = "Hello from Python!"
body = "This is a test email sent via Python and AbstractAPI 🎉"
# Send to only valid emails
for email in email_list:
if is_email_valid(email):
send_email(sender_email, email, subject, body, smtp_server, smtp_port, sender_email, password)
print(f"✅ Email sent to {email}")
else:
print(f"❌ Skipping invalid email: {email}")
🎯 Final Thoughts
Sending emails with Python is simple — but sending them effectively requires a bit more care.
By combining the convenience of Python’s built-in smtplib with the power of AbstractAPI’s Email Validation, you can create a robust, reliable, and professional email system that follows industry best practices.
✨ Validate before you send — and enjoy cleaner lists, fewer bounces, and better results.
