import smtplib import ssl from email.mime.text import MIMEText from datetime import datetime, timezone HOST = "127.0.0.1" PORT = 465 USER = "barant@barant.com" PASS = "imaptest123" TO = "brad.arant@gmail.com" ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE msg = MIMEText( "This is a live delivery test of the new BARANTMail server " "(SMTP + DKIM signing + SPF/DMARC on inbound, IMAP/POP3 now real).\n\n" f"Sent at {datetime.now(timezone.utc).isoformat()}." ) msg["Subject"] = "BARANTMail delivery test" msg["From"] = USER msg["To"] = TO s = smtplib.SMTP_SSL(HOST, PORT, context=ctx, timeout=20) s.set_debuglevel(1) s.ehlo("mail.barant.com") s.login(USER, PASS) s.sendmail(USER, [TO], msg.as_string()) s.quit() print("SENT")