Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Proxy smtp to a starttls server with authentication, from a local
- connection.
- """
- from inbox import Inbox
- from smtplib import SMTP
- inbox = Inbox()
- SMTP_HOST = 'mail.example.com'
- SMTP_USERNAME = 'username'
- SMTP_PASSWORD = 'password'
- @inbox.collate
- def handle(to, sender, body):
- """
- Forward a message via an authenticated SMTP connection with
- starttls.
- """
- conn = SMTP(SMTP_HOST, 25, 'localhost')
- conn.starttls()
- conn.ehlo_or_helo_if_needed()
- conn.login(SMTP_USERNAME, SMTP_PASSWORD)
- conn.sendmail(sender, to, body)
- conn.quit()
- inbox.serve(address='0.0.0.0', port=4467)
Add Comment
Please, Sign In to add comment