Files
medevio/Emailtest/10 EmailTest.py
2025-11-10 06:09:45 +01:00

30 lines
884 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import smtplib
from email.message import EmailMessage
# ========= CONFIG =========
SMTP_SERVER = "smtp.office365.com"
SMTP_PORT = 587
EMAIL_FROM = "ordinace@buzalkova.cz"
EMAIL_TO = "vladimir.buzalka@buzalka.cz"
SMTP_USER = "ordinace@buzalkova.cz"
SMTP_PASS = "********" # <- your Office365 APP PASSWORD (see note below)
# ==========================
# Create the email
msg = EmailMessage()
msg["Subject"] = "Test zpráva z Pythonu"
msg["From"] = EMAIL_FROM
msg["To"] = EMAIL_TO
msg.set_content("Dobrý den,\n\ntoto je testovací e-mail odeslaný z Python skriptu.\n\n--\nOrdinace MUDr. Buzalková")
# Send the email
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:
server.starttls() # enable TLS encryption
server.login(SMTP_USER, SMTP_PASS)
server.send_message(msg)
print("✅ E-mail byl úspěšně odeslán!")