Skip to content

mug1sha/SMTP_Python_automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“§ Gmail SMTP Email Sender with HTML Support

This Python script allows you to send HTML-formatted emails using Gmail’s SMTP server. It supports secure login with TLS encryption, App Passwords, and uses MIME multipart messages for rich content.


πŸš€ Features

  • βœ… Connects securely to Gmail via TLS
  • βœ… Uses App Password for authentication (Gmail 2FA-compatible)
  • βœ… Sends rich HTML emails
  • βœ… Supports Cc and Bcc headers
  • βœ… Clean error handling and debug output

πŸ“‚ Project Structure

πŸ“ SMTP/ β”œβ”€β”€ mail.html # HTML email template β”œβ”€β”€ html_mail.py # for html content mail └── README.md # This file |__ text_mail.py # for only text mails


πŸ” Gmail Setup (One-Time)

Gmail blocks less secure apps by default. You must enable 2FA and use an App Password.

πŸ› οΈ Steps:

  1. Go to https://myaccount.google.com/security
  2. Enable 2-Step Verification
  3. Go to https://myaccount.google.com/apppasswords
  4. Create an App Password (Select β€œMail” > β€œOther” > "Python SMTP")

πŸ§ͺ How to Run

1. Clone the Repository

git clone https://github.com/your-username/smtp-email-sender.git cd SMTP

  1. Create an mail.html file (or use the sample provided)

Hello there!

This is a test email sent using Python + Gmail SMTP.

  1. Run the script

python html_email.py

You’ll be prompted to enter your App Password securely.

πŸ›‘οΈ Security Notes Never hardcode passwords β€” use getpass or environment variables.

Don’t commit your mail.html with sensitive content unless it’s just a template.

This script is for educational and ethical use only.

✍️ Author Godson Mug1sha (aka KINGπŸ‘‘) Cybersecurity Student | Python Dev | Email Hacker (ethical) 🌐 Kigali, Rwanda

🧠 Future Improvements Add attachments support

Support for inline images

Switch to OAuth2 (no App Passwords)

GUI version with Tkinter or Electron

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors