send email from command line

Derek Broughton news at pointerstop.ca
Wed Sep 24 20:03:14 UTC 2008


Smoot Carl-Mitchell wrote:

> On Wed, 2008-09-24 at 10:42 -0300, Derek Broughton wrote:
>> Ken McLennan wrote:
>> 
>> > G'day there Derek,
>> > 
>> >> No, there shouldn't.  Mail was written by people who believe that mail
>> >> clients _shouldn't_ speak SMTP, and it _must_ have a
>> >> sendmail-compatible program to actually deliver the mail
>> 
>> >     I've no idea about the pros & cons of mtas. Is there a thumbnail
>> > version of the argument somewhere? or can you please explain why
>> > someone would think SMTP should be avoided?
>> 
>> In a word, "No". :-)  I've hashed this over so many times with so many
>> people, without getting a response that makes sense to me.  It's just a
>> Unix meme.  From the point of view of a program like "mailx", outputting
>> a message via SMTP syntax is no different from outputting it to a file -
>> it's all just I/O - but all the MTA developers I've ever corresponded
>> with (quite a few, especially since I hung out on the Exim developers
>> list for a while) swear that it's insane to have a client program need to
>> know SMTP
>> syntax.  I don't see where it makes a difference to have to know SMTP or
>> to have to know _sendmail_ syntax.
> 
> There is a distinct difference between SMTP and writing a mail message
> to a file.  SMTP is a transport protocol which defines the interaction
> between a client (sender) and a server (receiver) to move a mail message
> from one to the other.  You may be confusing the difference between the

Don't be insulting.  Of course I'm not confusing anything.  There _isn't_ a
distinct difference.  There's nothing essentially different between the
following conversation (system responses trimmed for clarity):

 derek at bella:~$ telnet localhost 25
 ehlo derek
 MAIL FROM: derek at localhost
 RCPT TO:derek at localhost
 Data
 subject: test manual smtp

 this is the message
 .
 quit

and:
 derek at bella:~$ mailx -s "test mailx" derek
 this is the message
 .

(and mailx's actual dialog with sendmail is more complicated than that...)

> transport protocol and the format of the message.  SMTP has nothing to
> do with the contents of a mail message.  To SMTP those contents are
> opaque.

Sort of - to the same extent they're opaque to sendmail.  otoh, the
recipient is quite capable of reading headers or even
the whole message body and sending an error response - which the user agent
still needs to be able to handle.  The only advantage of going through
sendmail is the ability for it to handle transparently handle the
transitory errors (eg, message queuing, as you said)

> Why go through all the muck of setting up a
> network connection 

In Unix, "all the muck" of setting up a network connection has never  been
harder than opening a file (well, maybe once - before my time - but a
network connection and a file are both just sockets).
-- 
derek





More information about the ubuntu-users mailing list