Mengirim email

from redmail import EmailSender
from pathlib import Path

# Configure an email sender
email = EmailSender(
    host="<SMTP HOST>", port=0,
    user_name="[email protected]", password="<PASSWORD>"
)

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