Skip to content

hann2004/email-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📧 Email Automation Script

This Python script automates the process of logging into a Gmail inbox, checking for unread emails, and printing out important details such as the sender, subject, and body in the terminal. I built this project to learn more about working with email protocols like IMAP and using environment variables to securely manage sensitive data.

🚀 Features

  • Logs into Gmail securely using credentials stored in a .env file.
  • Searches for unread (unseen) emails and displays key details.
  • Prints sender, subject, and body in the terminal.
  • Easy to customize and expand!

🛠 Technologies Used

  • Python 3
  • imaplib (for email access)
  • email (to handle email parsing)
  • python-dotenv (for managing environment variables securely)

⚙️ Setup Instructions

  1. Clone the repo

    git clone https://github.com/yourusername/email-automation.git cd email-automation

  2. Create and activate a virtual environment (optional but recommended)

    python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows

  3. Install dependencies

    pip install -r requirements.txt

  4. Create a .env file In the root of the project, create a .env file and add your credentials:

    EMAIL=[email protected] PASSWORD=your_app_password IMAP_SERVER=imap.gmail.com

    ⚠️ Important: Use a Gmail App Password, not your real Gmail password. You can generate an App Password here.

  5. Run the script

    python email_automation.py

🧠 What Amazon Q Could Do Here

If Amazon Q was involved in this project, it could:

  • Help explain the technical side of how IMAP works and offer suggestions for making the process more efficient.
  • Suggest adding features like scheduling automatic email responses or making the script run asynchronously.
  • Assist in securing secrets even more, perhaps using AWS Secrets Manager for safer storage of credentials.

🔐 .gitignore

To ensure your .env file isn’t uploaded to GitHub, make sure to add this line to your .gitignore:

.env

✍️ Author

This project was created by me, Hanan Nasir@hann2004

License

This project is intended for educational/demo purposes and has been submitted to the Amazon Q "Quack the Code" Challenge.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages