send email from command line

Smoot Carl-Mitchell smoot at tic.com
Wed Sep 24 20:57:21 UTC 2008


On Wed, 2008-09-24 at 17:03 -0300, Derek Broughton wrote:
> Smoot Carl-Mitchell wrote:

> > 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):

Whatever.  Read the protocol specs.  You are comparing apples to
oranges.

> 
> 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...)

There is no dialogue in mailx's interaction with the sendmail process.
It is simply a unidirectional pipe from mailx to sendmail down which the
message is passed.  mailx checks the exit code of the sendmail process
to see if the operation was successful.  It is a trivial operation
compared to handling a bidirectional SMTP dialogue.

> 
> > 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).

It is a tad harder and handling the dialog is definitely harder than
managing a unidirectional pipe to a forked process.  Take a look at the
client smtp code in sendmail and compare it with the pipe/fork handling
of sending a mail messages in mailx sometime.
-- 
Smoot Carl-Mitchell
System/Network Architect
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005




More information about the ubuntu-users mailing list