Freebsd - Mail configuration and syntax

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon May 31 02:09:18 PDT 2004


On Mon, May 31, 2004 at 09:32:21AM +0100, Carla Neves wrote:

> I would like someone to give me some good tips to configure my email 
> on Freebsd v4.9, to send/receive messages. I would like to use what I 
> have already installed: sendmail, mailx. I went through the Freebsd 
> manual but I coulnd't find any tips for the syntax of 
> sending/receiving emails, just the sendmail configuration. So I would 
> apreciate your help to give me the good steps for:

Hmmm... the mailx command always used to be a SysV thing -- in fact, a
port of the BSD mail(1) command, which they had to rename because they
already had a mail(1) command which did something completely
different.

Looking at the pkg-descr for the mail/mailx command it actually looks
almost identical to the mail(1) command in the base system.  
 
> 1- Configuring sendmail (although is already in the manual)

Could you be more specific about what you want to do with your e-mail
system?  In general, all things are possible (e-mail wise) using
sendmail, but not necessarily easy or obvious.

> 2- Syntax used to send email (with examples would be great).

Well, to use mail(1) to send an e-mail from the command line it's
pretty much:

    % mail -s "Message Subject here" addressee at example.com

Then type in your message ending with a ^D or a '.' on a line by
itself.  There are a number of ~-escapes you can use to do things like
invoke an editor or edit the message headers.

For use in scripting, mail(1) is quite handy -- you can do something
like this:

     mail -s "Automatic Message" recipient at example.com <<E_O_M
     The contents of the message goes here.

     As much as you like, really.

     E_O_M

but it's more efficient to pipe stuff directly into sendmail:

     /usr/sbin/sendmail -t -oi -oem <<E_O_M
     To: recipient at example.com
     Subject: Automatic Message

     The contents of the message goes here.

     As much as you like, really.

     E_O_M

> 3- Syntax to see the received emails.

Just type mail to get a listing of your inbox, then type the message
number to read that message, or 'n' for the next message.
 
> I went through the man pages of mailx and sendmail, but they seem not 
> to be very userfriendly for someone who is quite knew configuring 
> email on Freebsd. So could you please help me?

sendmail is quite hard to deal with.  A very good resource is the file
/usr/share/sendmail/cf/README which summarises all of the options you
can put into a .mc file.  The Sendmail Operations manual in
/usr/share/doc/smm/08.sendmailop/paper.ascii.gz also contains a great
deal of useful stuff.  However, if you really want to get to grips
with it, you should look at the bat book -- Sendmail, 3rd Ed. Costales
and Allman, O'Reilly (http://www.oreilly.com/catalog/sendmail3/)

Personally, I'm not a big fan on the mail(1) command for interactive
use -- mutt(1) is much better.  Lots of people like pine(1) and it's
certainly a lot more friendly towards beginning users.  Then there are
e-mail clients available for emacs, plus a whole range of GUI mail
clients such as Mozilla mail, Thunderbird, Evolution etc.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040531/3eeddcbf/attachment.bin


More information about the freebsd-questions mailing list