Skip to main content

Send mail to SMTP

Project description

This script will send an email and send you an alert on the configured notifiers

PyPI PyPI versions Python test Code Style

Why ?

When a company wants you to send an email every month to get what you need because they don't want to send it automatically to piss you off. meme

Install

pip install autoemailsmtp

Config

Create an .env file with this content or create environment variables

AUTOEMAILSMTP_SMTP_HOST="smtp.example.com"
AUTOEMAILSMTP_SMTP_PORT=587
AUTOEMAILSMTP_SMTP_USERNAME="toto@example.com"
AUTOEMAILSMTP_SMTP_PASSWORD="mypassword"

Optional:
AUTOEMAILSMTP_LOG_LEVEL="INFO"
AUTOEMAILSMTP_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/aaaaaa/aaaaa"

Systemd

To send an email each month you can setup a cron or use systemd like (must be adapated). Service file

[Unit]
Description=send an email
After=network-online.target

[Service]
Type=oneshot
ExecStart=/opt/autoemailsmtp/venv/bin/python autoemailsmtp.send_mail.py --to email@example.com --subject "rent" --file rent_receipt --discord

[Install]
WantedBy=multi-user.target

Systemd timer file

[Unit]
Description=Send an email on the 10th of every month

[Timer]
OnCalendar=*-*-10 08:00:00

[Install]
WantedBy=timers.target

Dev

Install Poetry

Install and setup dependencies

poetry install
poetry shell
pre-commit install

Run pre-commit

pre-commit run --all-files

Licence

The code is under CeCILL license.

You can find all details here: https://cecill.info/licences/Licence_CeCILL_V2.1-en.html

Credits

Copyright © Ludovic Ortega, 2023

Contributor(s):

-Ortega Ludovic - ludovic.ortega@adminafk.fr

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoemailsmtp-0.1.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

autoemailsmtp-0.1.0-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file autoemailsmtp-0.1.0.tar.gz.

File metadata

  • Download URL: autoemailsmtp-0.1.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Linux/5.15.0-1034-azure

File hashes

Hashes for autoemailsmtp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f8cc1233971648b3f1dc40a32c7f653931ca089cec9d815cefc42093a95aef7
MD5 d5a4d4f33aeca9f85c34fc9e40d6bcae
BLAKE2b-256 d2238d8a1dbff048d737ba5576fed9a92f6c2bd62527a6de73999f8ce5c9ac8a

See more details on using hashes here.

File details

Details for the file autoemailsmtp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: autoemailsmtp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Linux/5.15.0-1034-azure

File hashes

Hashes for autoemailsmtp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc8bb883367abd4a862cb266489672aec59375037ba845118860eb42d555994
MD5 655ce58b2cb130fca7468cc461c8fce7
BLAKE2b-256 c61d92f05daa7fb43366754e49cde1e6fd1d71272b2139727bb332bdbb53cd33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page