A small desktop app that sends the HTML email in mail_content.html to every recipient listed in an Excel file.
Install Python 3, then install the required packages from this project folder:
python -m pip install pandas openpyxl python-dotenvtkinter is included with most standard Python installations. If the app does not open, reinstall Python and ensure the optional Tcl/Tk component is selected.
This program sends through Gmail's SMTP server. Do not put your usual Google account password in the environment file. Use a Google App Password instead.
- Enable 2-Step Verification for the Gmail/Google account that will send the emails: https://myaccount.google.com/security.
- Open the App Passwords page: https://myaccount.google.com/apppasswords.
- Create an app password (for example, name it
Bulk Mailer). - Google will show a 16-character password. Copy it; it is shown only once.
If the App Passwords page is unavailable, 2-Step Verification may not be enabled, or the Google account administrator may have disabled app passwords.
In the project folder, create a file named .env (no filename before the dot). You can copy .env.example and replace its values:
EMAIL=youraddress@gmail.com
EMAIL_PASSWORD=your_16_character_google_app_passwordEMAILis the Gmail address that appears as the sender.EMAIL_PASSWORDis the App Password from the previous section. Spaces are optional; either format normally works.
The .env file is already ignored by Git, so keep it private and never share or commit it.
Create an Excel file (.xlsx or .xls) with a column whose header is exactly Email.
| person1@example.com |
| person2@example.com |
Blank cells are skipped. The program will show an error if the Email column is missing.
- Edit
mail_content.htmlto change the email design and message. - Edit the
msg["Subject"]value inmain.pyto set the email subject. It currently saysadd mail subject.
From the project folder, run:
python main.pyClick Browse, select the recipient Excel file, and the app will send the email to each address in its Email column. The terminal prints each successful recipient, and the app displays a final total when it is done.
- Test with your own email address before sending to a full list.
- Gmail may limit or temporarily block high-volume sending. Use this only for recipients who have agreed to receive the message.
- Keep the
.env,main.py, andmail_content.htmlfiles together in the project folder when running the program.