[prog] Mailing list software - how does the emailing work? (mass bcc?)

Mary mary-linuxchix at puzzling.org
Tue May 10 19:30:46 EST 2005


On Tue, May 10, 2005, Dan wrote:
> The upshot of this is that you could probably get away with sending
> e-mail with a header like "To: Simba the Elephant". However, some mail
> clients might choke on that because they're not expecting it. I really
> don't know what most mail clients do when they receive messages with
> weird "To" headers (or no "To" headers at all), so I don't know what a
> good "To" header would be for you, but rest assured that the server
> ignores the "To" header.

Most fill in "undisclosed recipients" or something of the kind when they
don't find a To header. 

If you want to find out for sure, you can always just telnet to port 25
of your incoming mail server and send a mail to yourself to find out.
eg:

[you type at shell prompt] telnet mymailserver.example.com 25
[telnet gives you some output ending with a line beginning with] 220
[you type] HELO mylocalmachine.example.com
[server replies] 250
[you type] MAIL FROM:<myemailaddress at example.com>
[server replies] 250
[you type] RCPT TO:<myemailaddress at example.com>
[server replies] 250
[you type] DATA
[server replies] 354 End data with <CR><LF>.<CR><LF>
[you type] Subject: My test mail
[you type blank line]
[you type] Test body
[you type] .
[server replies] 250

This will result in a mail going through that only has one header
("Subject: My test mail") and a body consisting of "Test body". No To,
and no From! You can see what your mail client does with it. The biggest
thing you'll notice is that it will probably think the mail is dated Jan
1 1970.

Just FYI, the server uses the RCPT line to work out who the mail is for.
It totally ignores the headers themselves, which aren't sent until the
DATA command. Headers are for your mail client. SMTP commands are for
your mail server.

Now, I wouldn't recommend trying to program an SMTP server or client
unless you have to or really want to. There are millions of convienient
wrappers that let you inject a mail into your system without having to
talk SMTP over a socket (the "mail" binary and many mail libraries in
programs, like people have been discussing here). But I do think mucking
around with telnet and sending some mails over SMTP by hand helps
illustrate the concepts.

-Mary


More information about the Programming mailing list