Subj? A B C D E F G
Type message text, end with line=[Ctrl+d (Unix), Ctrl+z (Windows)]
Fiddle de dum, Fiddle de dee,
Eric the half a bee.
^Z
Connecting...
No errors.
Bye.
This mail is sent to the book’s email account address ([email protected]), so
it ultimately shows up in the inbox at my ISP, but only after being routed through an
arbitrary number of machines on the Net, and across arbitrarily distant network links.
It’s complex at the bottom, but usually, the Internet “just works.”
Notice the From address, though—it’s completely fictitious (as far as I know, at least).
It turns out that we can usually provide any From address we like because SMTP doesn’t
check its validity (only its general format is checked). Furthermore, unlike POP, there
is usually no notion of a username or password in SMTP, so the sender is more difficult
to determine. We need only pass email to any machine with a server listening on the
SMTP port, and we don’t need an account or login on that machine. Here,
the name [email protected] works just fine as the sender;
[email protected] might work just as well.
In fact, I didn’t import a From email address from the mailconfig.py module on purpose,
because I wanted to be able to demonstrate this behavior; it’s the basis of some of those
annoying junk emails that show up in your mailbox without a real sender’s address.‖
Marketers infected with e-millionaire mania will email advertising to all addresses on
a list without providing a real From address, to cover their tracks.
Normally, of course, you should use the same To address in the message and the SMTP
call and provide your real email address as the From value (that’s the only way people
will be able to reply to your message). Moreover, apart from teasing your significant
other, sending phony addresses is often just plain bad Internet citizenship. Let’s run
the script again to ship off another mail with more politically correct coordinates:
C:\...\PP4E\Internet\Email> smtpmail.py
From? [email protected]
To? [email protected]
Subj? testing smtpmail
Type message text, end with line=[Ctrl+d (Unix), Ctrl+z (Windows)]
Lovely Spam! Wonderful Spam!
^Z
Connecting...
No errors.
Bye.
‖We all know by now that such junk mail is usually referred to as spam, but not everyone knows that this
name is a reference to a Monty Python skit in which a restaurant’s customers find it difficult to hear the
reading of menu options over a group of Vikings singing an increasingly loud chorus of “spam, spam, spam...”.
Hence the tie-in to junk email. Spam is used in Python program examples as a sort of generic variable name,
though it also pays homage to the skit.
914 | Chapter 13: Client-Side Scripting