aiosmtpd - python smtp server
--
Track title: CC M Beethoven - Piano Sonata No 3 in C 3
--
Chapters
00:00 Question
02:03 Accepted answer (Score 5)
03:28 Thank you
--
Full question
https://stackoverflow.com/questions/4402...
Accepted answer links:
[Email § Operation]: https://en.wikipedia.org/wiki/Email#Oper...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #smtp #smtplib #aiosmtpd
#avk47
ACCEPTED ANSWER
Score 6
In your code, Controller(Sink(), hostname='::0', port=8025) starts an SMTP server that receives messages on port 8025 and throws them away (the Sink() part). That's why the messages don't show up in your inbox -- when you send an email to localhost:8025, it is never actually sent to your inbox.
aiosmtpd is an SMTP server, meaning it will receive messages sent via SMTP and process them somehow. In your code, the Sink() handler does not process incoming email in any way -- it simply throws incoming messages away.
If you want to send email over the Internet to bob@hate.com, then you should contact the SMTP server responsible for the hate.com domain instead of the SMTP server you're running using aiosmtpd. For this task you will not need to run an SMTP server, since there's supposedly already an SMTP server on the internet running for hate.com; instead, you will need an SMTP client component, which is provided in the smtplib module in the Python standard library. Sending email with SMTP is not something that aiosmtpd is involved with in any way, and you should look for how to use smtplib instead.
Further reading: Email § Operation on Wikipedia.