Here’s a complete **Python script** to send an email with an attachment to
**multiple recipients**, sending **one email at a time** to each, using a Gmail
account and **App Password** authentication:
---
### ✅ Prerequisites:
* [Create an App Password from Gmail](https://myaccount.google.com/apppasswords)
(if using 2FA).
* Install required library (if not already):
```bash
pip install secure-smtplib
```
---
### ✅ Python Script to Send Individual Emails
```python
import smtplib
from email.message import EmailMessage
import os
# Email account credentials
EMAIL_ADDRESS = "
[email protected]"
EMAIL_PASSWORD = "your_app_password" # 16-character app password from Gmail
# List of recipients
recipients = [
"[email protected]",
"[email protected]",
"[email protected]",
# Add more...
]
# Email content
subject = "Exploring Opportunities – Backend Software Engineer"
body = """
I wanted to reach out to discuss potentially working together.
I’m a Backend software engineer working in LendingKart and currently seeking new
opportunities.
PFA my resume for your reference
LinkedIn: https://www.linkedin.com/in/ashish-singh-39127b288
Thanks and Regards
Ashish Singh
"""
# Path to resume
resume_file = "Ashish_Resume.pdf" # Change to your resume file path
# Send email to each recipient one by one
for recipient in recipients:
try:
msg = EmailMessage()
msg['Subject'] = subject
msg['From'] = EMAIL_ADDRESS
msg['To'] = recipient
msg.set_content(body)
# Add attachment
with open(resume_file, 'rb') as f:
file_data = f.read()
file_name = os.path.basename(resume_file)
msg.add_attachment(file_data, maintype='application', subtype='pdf',
filename=file_name)
# Send email
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
smtp.send_message(msg)
print(f"Email sent to {recipient}")
except Exception as e:
print(f"Failed to send email to {recipient}: {e}")
```
---
### ✅ Notes:
* Emails are sent **sequentially**.
* The script will **print success/failure** for each recipient.
* You can expand the recipients list via a CSV or a text file if needed.
Let me know if you want a version that reads recipients from a file.