test_mail.py 827 B

1234567891011121314151617
  1. import smtplib
  2. from email.message import EmailMessage
  3. try:
  4. msg = EmailMessage()
  5. msg.set_content("This is an automated local environment test from the Clinical Food AI platform. If you are receiving this, your secure loopback postfix configuration is verified and functioning flawlessly over Port 25!")
  6. msg['Subject'] = "Local Food AI: Internal Subnet Verification"
  7. msg['From'] = "system@localfoodaimaster.com"
  8. msg['To'] = '"Mr Lange François" <flange@pt.lu>'
  9. # Strict loopback port explicitly targeting postfix configurations to bypass 0.0.0.0 leaks
  10. s = smtplib.SMTP('localhost', 25)
  11. s.send_message(msg)
  12. s.quit()
  13. print("✅ Email dispatched perfectly via local postfix socket!")
  14. except Exception as e:
  15. print(f"❌ Failed to reach or broadcast via local SMTP Postfix. Error: {e}")