Managing your HCS email

Tagged:

Every HCS group account comes with an email address, group-name@hcs.harvard.edu. You will probably want to check this regularly, as it is the way that HCS account services will contact you, and it is also a convenient address for your group to advertise because you won't have to change it from year to year even if your management changes hands. However, since HCS doesn't provide IMAP or POP service (yet), you will have to check your mail via the terminal, or set up forwarding to one of your other accounts, like your FAS account or your gmail account. Anybody who is on the access list for your account can do either of these things.

Neither of these are difficult to do at all! Read on for the instructions.

Checking mail via the terminal

The best way to check mail while logged into your account is to use pine. At your prompt, simply type

pine

to launch it. If you've ever used it on your FAS account, you should be all set since it's exactly the same deal.

From the FASCS Knowledge Base:

Pine is an electronic mail program recommended by FAS Computer Services for both new and more experienced users. It offers a menu-driven interface with on-line help.

Pine provides email basics such as reading, sending, storing, and forwarding mail. The default editor, Pico, allows easy editing using the arrow keys and performs automatic word-wrap. Moreover, Pine offers more advanced features such as Address Book which allows users to create convenient mail aliases...

Yeah yeah, it's great and so on. Upon running pine, you should note the area at the bottom of the screen which shows you what keys you can press to do things. So, if you ever need to know how to do something, this would be the first place to check. The initial menu is pretty straightforward: use your arrow keys to select a destination and hit Enter. Most likely, you'll want the Message Index, which will list all your messages in your inbox.

The Message Index screen has several columns, all of which should show familiar information. The leftmost column shows the message status. The most common codes are:

  • "D" for Deleted. You have marked this message for deletion but not yet eXpunged the folder.

  • "N" for New. You have not looked at the text of the message yet.
  • "A" for Answered. Any time you reply to a message it is considered to be answered.
  • "+" for direct-to-you. The "+" indicates that a message was sent directly to your account, your copy is not part of a cc: or a mailing list.

    The rest of the columns will look much like the display in any mail client: message number, date received, sender, and subject. Navigate with the arrow keys and hit D to delete all the obvious spam, and then press Enter when you find a message you want to read.

    While reading a message, the relevant keys to know are:

    • R for Reply: Opens up a compose window to reply to the message.
    • F for Forward: Opens up a compose window to forward the message.
    • D for Delete: Marks the message for deletion.
    • U for Undelete: Unflag the message for deletion.
    • Arrow keys: Scroll.
    • Space bar: Page down.
    • -: Page up.
    • N for Next: Move to the next message in the list.
    • P for Previous: Move to the previous message in the list.

    Marking a message for deletion automatically moves you to the next message. Deleting messages doesn't permanently remove them until you hit X for eXpunge from the Message Index view. You will also be asked to eXpunge when you quit pine.

    Hitting C from the Main Menu or the Message Index, or replying or forwarding any message, opens the Compose view. In the Compose view, you'll notice that the key commands at the bottom of the screen are all preceded by the carat ^ sign, which indicates you now have to hold down Control and then press the appropriate letter. Navigation is again with the arrow keys; edit the To, CC, and Subject fields to your liking, and then go down and enter your message. The composing experience is very much like using pico. When you are finished, hit Control-X and then Y to send the message. Or, to abandon the message, press Control-C to cancel; you will need to confirm with C.

    pine can also handle the sorting of mail between multiple folders. To access the folder list from the Message Index, hit the < key, or from the main menu select Folder List. Here you can select between multiple mail folders to view in the Message Index.

    Finally, to quit pine, hit Q from just about any view (excepting the Compose view).

    For further help with pine, just about every screen has a Help option available from the displayed key commands. The online help in pine is a pretty thorough reference, but if you want an even longer tutorial on using pine, try the UWash pine tutorial.

    Setting up Forwarding

    pine might be nice, but you may prefer collecting all your email in one inbox for your convenience. If you do, then mail forwarding is probably your best option.

    Mail forwarding is very easy to set up! All you need to do is edit one file in your home directory, and our mail handler will do the rest. Login to your HCS account and type

    pico ~/.forward

    If you already have a .forward file, then it will display; otherwise you will be editing a blank file. All that's in a .forward file are a list of email addresses that will receive mail that is sent to your HCS address. An example is:

    student-group@gmail.com
    jharvard@fas.harvard.edu
    bill.gates@microsoft.com

    Note that this will prevent any mail from being stored in your HCS inbox, which is a great idea if you don't intend on checking it. But if you do want copies of your mail stored on the HCS account, then add \group-name to the list, where group-name is your HCS account name. That backslash is very important! If you leave it out, your mail will get stuck in an infinite loop, and you will max out your account with millions of bounces the next time somebody sends you mail (which is hilarious, but very inconvenient). So for example:

    \group-name
    student-group@gmail.com
    jharvard@fas.harvard.edu
    bill.gates@microsoft.com

    would save a copy in your account, and still forward everything to the other three addresses.

    When you're done in pico, remember that you use Control-X to exit, and if you made changes you will confirm saving them by hitting Y (you may also have to confirm the filename if it was blank to begin with). And then that's it! Your forwarding is all set up. Send a test message to yourself to make sure it works as you intended.

    If you want, you can even set a filter up in your mail program to automatically move all of your mail forwarded from HCS to its own folder. For example, with Thunderbird, create a new folder in one of your mailboxes, and then go to Tools>Message Filters... and click New... and set up something like this:

    The final word: Handling spam

    Once you advertise your new HCS email address, you may find yourself receiving a healthy amount of unsolicited email. Unsolicited email wastes your time and our bandwidth and can make it easier for your inbox to run over quota. The best first step to take is to only insert your email address on your website in an obfuscated format so that spambots, which are programs that crawl the web looking for addresses, won't pick it up. An example is using group-name [AT] hcs.harvard.edu everywhere on your site instead of the easily-crawled group-name@hcs.harvard.edu. Of course this is a little inconvenient for your users, so if you want to be fancier you can insert a little javascript program such as the following:

    <SCRIPT TYPE=“text/javascript”>
    <!--
    emailaddress=('group-name@' + 'hcs.harvard.edu')
    document.write('<A href=“mailto:' + emailaddress + '”>' + emailaddress + '</a>')
    //-->
    </SCRIPT>

    substituting in your account name for group-name, and this should sufficiently protect your address while providing a fully functional link to your viewers. Note, however, that if they don't have JavaScript enabled that nothing will show up.

    Using procmail and SpamAssassin

    You can also try to use our SpamAssassin software to filter your mail. All mail coming into HCS servers is automatically tagged by this software as either spam or not spam. This tagging is not perfect, but it is pretty accurate. The first step is to create a spam folder for your spam messages:

    mkdir ~/mail/spam
    chmod 600 ~/mail/spam

    Now to set up procmail with SpamAssassin, run pico ~/.procmailrc and enter the following into a file (it looks cryptic, but you can read up on procmailrc techniques if you are curious):

    :0:
    * ^X-Spam-Flag: YES
    mail/spam

    Then hit Control-X and then Y to quit and save changes.

    (For the curious, procmail can do all sorts of more complicated things; you can read some examples by typing man procmailex at the prompt.)

    There you go! Send a test message to yourself to make sure it all works, and then make sure to check your "spam" folder via pine every once in awhile to make sure you aren't junking anything real. You can help train our filter by forwarding spam to spam@hcs and false positives to notspam@hcs.

    Clearing your inbox

    OK, say you haven't logged in for ages and your inbox is a heap of junkmail. Or say you messed up your .forward and looped a couple million messages into your inbox. We can help you clear out everything quickly, with the help of pine.

    In pine at the Main Menu, go to Settings and then hit C to enter Config. We want to scroll allll the way down to [ Advanced Command Preferences ], under which you'll find "enable-aggregate-command-set". If it's not on, turn it on: hit Enter to toggle it. Then type E to exit setup, and Y to save your changes. You're back at the main menu. (For the curious, we just enabled a way to select a bunch of messages at once and delete them all at once).

    Enter the Message Index. Now you want to hit the semicolon ; key on your keyboard, it will give you the prompt ALTER message selection:. You can then choose a subset of your messages by a few different criteria: you can hit A for all, or select by Date with D, or by Number with N. If you choose number, you will be prompted to enter a range like 300-500; if by date you can toggle between modes with Control-W and then move the date around with Control-P and Control-N and select all messages received after August 25, 2007, for example. Whatever you do, you'll see a bunch of X's appear before all the messages you select.

    Now is the chance to clear them all out in one shot. Hit A to Apply a command, and then hit D for Delete. You just marked a ton of messages for deletion. All there is left to do is eXpunge them, and get the hell out (Q for Quit).

    Hopefully this tutorial has helped you handle your group mail more efficiently. For anything we didn't manage to cover, you can always ask us by emailing acctserv@hcs. For bonus points, use pine to do it straight from your HCS account!