Pages: 1, 2
Now that we have the necessary software, we need to create a user account to use when sending and receiving e-mail. You can either create a user with the same name as the mailbox portion of your e-mail address, or you can create an alias to map an existing user to the mailbox name. Since my e-mail address is firstname.lastname@example.org, to keep my life simple on my home FreeBSD box, I create a user called genisis. When I wish to access my e-mail, I log in to my FreeBSD system as the user genisis. This trick is useful on small systems as it saves you editing an alias file.
If you need to create a new user, become the superuser and type
/stand/sysinstall and select Configure | User Management | User. The login ID should be the same as the name of the mailbox, so in my case it is genisis. Input a password you'll remember and tab over to OK. Arrow over to Cancel twice, then arrow over to Exit Install.
Leave the superuser account and log in as the new user. Now type
pine -- you should see the following message:
Creating subdirectory "/home/yourusername/mail" where Pine will store its mail folders.
sendmail, 2nd Edition
This will be followed by Pine's greeting text. You'll notice that Pine's commands are always listed at the bottom of your screen. The ^ symbol means use your CTRL key along with the letter next to the ^. Once you've read the greeting, use ^E (Exit This Greeting). This will bring you to Pine's main menu.
Since this is the first time you are running Pine as this user, you'll need to press S to enter Setup, then C to enter Config. The first three items should be edited as follows:
- personal-name -- Press C to change its value and type in what you want the world to see when you send an e-mail; for example, mine is set to Dru.
- user-domain -- Change this so it's the same value as the text to the right of the @ in your e-mail address; for example, mine is set to istar.ca.
- smtp-server -- This should be the same value as user-domain.
You'll notice that Pine supports a lot of configuration values; if you find one that sounds interesting, highlight it and press the ? key. This will give a short, and usually helpful, description of what this configuration parameter does. I usually change the following on mine:
Under Viewer Preferences -- I use the Enter key to put an [X] in the following values:
This will highlight URLs and e-mail addresses so I can go directly to a web site or add an address to my address book.
- I receive a lot of e-mail, so I constantly change the value of the sort-key. If I'm expecting an e-mail from a particular person, I'll change it to "From"; if I'm sorting through mailing lists, I'll change it to "Subject."
- The very last configuration parameter in Pine is url-viewers. I change this to /usr/local/bin/lynx. Since Pine will highlight URLs in my e-mail messages (because I told it to with the enable-msg-view-urls value), it will invoke Lynx to open the site for me.
Once you've finished your configurations, press E to exit Setup and Y to commit changes. This will return you to the main menu where you can press A to edit the address book. The @ key will let you add an e-mail address; when you're finished, type ^X and the address should now show in your address book.
Highlight a user you've added to your address book and press C to compose an e-mail message to them. Arrow down to Cc and input your e-mail address so you'll be sent a copy of the message. Once you've composed your message, make sure you are connected to your ISP and press ^X to send your message. Type y when Pine asks you if you want to send the message. It should say [Sending Mail], then [Message sent and copied to 'sent-mail'.] Use your < key to return to the main menu, then L to enter the folder list. If you arrow over to sent-mail and press enter, you should be able to view and read the message that you sent.
One last point on Pine: it contains a built-in editor called Pico. Pico is a very easy editor to learn as its commands are always listed on the bottom of the screen. You don't have to run Pine to use Pico; if you want to edit a file with Pico, do this:
Now that you've sent your first e-mail with Pine, you'll want to check that you received your copy of the e-mail by using the fetchmail program. Open up another virtual terminal, and log in as your user. I use fetchmail like so:
fetchmail istar.caEnter password for email@example.com: fetchmail: IMAP connection to istar.ca failed: Connection refused 1 message for genisis at istar.ca (868 octets). reading message 1 of 1 (868 octets) flushed
When you check your e-mail, substitute the value to the right of the @ in your e-mail address for istar.ca. If everything worked, fetchmail will download at least one message. Return to the terminal where you are running Pine and navigate to your inbox to read it.
Note that fetchmail added genisis to my e-mail address for me because I am logged in as genisis. If I happened to be logged in as another user, say biko, it would use the address firstname.lastname@example.org instead.
The fetchmail command would then fail as I don't have a mailbox called biko on Istar's mail server. However, if I'm logged in as biko and invoke fetchmail like so:
fetchmail -u genisis istar.ca
This will tell fetchmail to use the mailbox name of genisis instead of my login name of biko so I can retreive genisis' email.
Fetchmail also has a verbose mode which can be used to view the various
POP3 commands between fetchmail and the mail server. You can invoke
verbose mode with
-v and very verbose mode with
-vv. Here is a portion of a session with fetchmail in verbose mode:
Enter password for email@example.com:
fetchmail -v istar.ca
fetchmail: 5.3.0 querying istar.ca (protocol auto) at Mon, 31 Jul 2000 11:16:28 -0400 (EDT)
fetchmail: 5.3.0 querying istar.ca (protocol IMAP) at Mon, 31 Jul 2000 11:16:28 -0400 (EDT)
fetchmail: IMAP connection to istar.ca failed: Connection refused
fetchmail: 5.3.0 querying istar.ca (protocol POP3) at Mon, 31 Jul 2000 11:16:28 -0400 (EDT)
fetchmail: POP3< +OK iSTAR POP3 Server at istar.ca Ready v1.13 12.2.1996 <firstname.lastname@example.org
fetchmail: POP3> USER genisis
fetchmail: POP3< +OK Complete authentication with the PASS command for email@example.com
fetchmail: POP3> PASS *
fetchmail: POP3< +OK Authentication successful.
fetchmail: POP3> STAT
fetchmail: POP3< +OK 5 29820
fetchmail: POP3> LAST
fetchmail: POP3< +OK 0
5 messages for genisis at istar.ca (29820 octets).
fetchmail: POP3> LIST
fetchmail: POP3< +OK 5 messages (29820 octets)
fetchmail: POP3< 1 8777
fetchmail: POP3< 2 8961
fetchmail: POP3< 3 4837
fetchmail: POP3< 4 2806
fetchmail: POP3< 5 4439
You should be able to recognize the
LIST commands from the tutorial.
Fetchmail is highly configurable through its use of switches; its manpage is well worth reading.
Hopefully, we've cleared up some of the mystery regarding how e-mail works. Next week, we'll look at setting permissions.
Dru Lavigne is a network and systems administrator, IT instructor, author and international speaker. She has over a decade of experience administering and teaching Netware, Microsoft, Cisco, Checkpoint, SCO, Solaris, Linux, and BSD systems. A prolific author, she pens the popular FreeBSD Basics column for O'Reilly and is author of BSD Hacks and The Best of FreeBSD Basics.
Read more FreeBSD Basics columns.
Discuss this article in the Operating Systems Forum.
Return to the BSD DevCenter.