Foundations of Python Network Programming

(WallPaper) #1
Chapter 13 ■ SMtp

245

Second, SMTP is used between Internet e-mail servers as they move e-mail from its origin to its destination. This
typically involves no authentication; after all, big organizations like Google, Yahoo!, and Microsoft do not know the
passwords of each other’s users, so when Yahoo! receives an e-mail from Google claiming that it was sent from an
@gmail.com user, Yahoo! just has to believe them (or not—sometimes organizations blacklist each other if too much
spam is making it through their servers. This happened to a friend of mine when Hotmail’s e-mail server stopped
accepting his e-mail newsletters from GoDaddy’s servers because of alleged problems with spam).
Thus typically no authentication takes place between servers talking SMTP to each other—and even encryption
against snooping routers seems to be used only rarely.
Because of the problem of spammers connecting to e-mail servers and claiming to be delivering e-mail from
another organization’s users, there has been an attempt made to lock down which specific servers can send e-mail
on an organization’s behalf. Though controversial, some e-mail servers consult the Sender Policy Framework (SPF),
defined in RFC 4408, to see whether the server to which they are talking really has the authority to deliver the e-mails
it is transmitting.
Let’s turn to the technical question of how you will actually use SMTP from your Python programs. Figure 13-1
provides an example of a Python-driven SMTP session.


Figure 13-1. An example of a Python-driven SMTP session

Free download pdf