Отправка электронных писем

from redmail import EmailSender
from pathlib import Path

# Configure an email sender
email = EmailSender(
    host="<SMTP HOST>", port=0,
    user_name="me@example.com", password="<PASSWORD>"
)

# Send an email
email.send(
    sender="me@example.com",
    receivers=["you@example.com"],
    subject="An example email"
    attachments={
        "myfile.txt": Path("path/to/a_file.txt"),
        "myfile.html": "<h1>Content of a HTML attachment</h1>"
    }
)
Handsome Horse