10

@gmail_python_function

An open source function to send emails using Gmail (or other providers).

An open source function to send emails using Gmail (or other providers).

Requirements

  • Gmail Account
  • Python
  • Pip

Setup

  1. Create a virtual environment
python -m venv venv
  1. Activate the virtual environment
./venv/scripts/activate
  1. Install requirements
pip install -r requirements.txt
  1. Replace EMAIL_FROM and app_password with your gmail (or other provider's) details. You can follow these instructions for Gmail

Gmail Link

    EMAIL_FROM = "youremail@gmail.com"
    app_password = "000000000000" # you can create an app password from your gmail account security settings
  1. Replace "example@gmail.com" with the email to send
response = send_email("example@gmail.com", [], "Testing Function", "Hi there. It's working well")
  1. Run the function
python app.py

testing