LizardMail

From LizardWiki, FastLizard4's wiki and website
Jump to: navigation, search

This is information regarding LizardMail, LizardNet's email service. If you have SSH access to one or more LizardNet servers, each SSH account you have on each server will have an email inbox as well as email sending capabilities. This page will explain how to leverage those capabilities.

There are three primary ways you can interface with LizardMail:

  • In a SSH terminal window itself (using GNU mailutils - the mail command)
  • In your web browser using LizardNet Webmail
  • Using a third-party email client (such as Mozilla Thunderbird, Microsoft Outlook, Apple iMail, etc.) over IMAP/POP3 and SMTP.

Notes

  • Your LizardNet email address(es) take the form of ssh-login-name@ssh-login-server.fastlizard4.org - for example, memoryhole@phazon.fastlizard4.org, except if your SSH login server is ridley.fastlizard4.org, in which case your LizardMail address is of the form sh-login-name@fastlizard4.org.
  • Abuse of LizardMail is sufficient grounds for immediate account termination. Use of LizardMail is monitored.

From the Terminal

This method, though convenient, is probably the most difficult since GNU mailutils isn't exactly the easiest thing to do. We recommend setting up a third-party email client like Thunderbird, Microsoft Outlook, or Apple Mail, though an easier solution is to use the in-browser webmail.

Checking mail

Log in to the server using SSH like you normally would. After the MOTD prints, you will see either "No mail." or "You have new mail." (or similar). The latter, of course, means that you have new mail. If you have new mail, simply run the mail to check your new emails. Use the ? command in the mail viewer for some basic assistance. To check saved mails, use the command mail -f mail/Saved. New messages that are not automatically deleted are saved when you quit the mail program.

If you are already logged into the server and a new message arrives, you should get a message that says You have new mail in /var/mail/username.

Note that it is very difficult to read HTML emails using this method, since you will see the HTML source code. To read rendered HTML emails, you must use an email client.

Sending mail

To initiate the process, log in to the server using SSH like you normally would. Then, type the command:
mail tolist
...where tolist is a space-separated list of email addresses you'd like to send the message to. Valid inputs for the tolist might be:

  1. example@example.com - This will send the email to example@example.com only.
  2. 'Example User <example@example.com>' - This will send the email to example@example.com only and display the destination's name, Example User, instead of just their email address. Since the spaces in this example aren't intended to separate two email addresses, the address must be surrounded with single quotes! Also note the use of angle brackets to delimit the email address itself.
  3. example@example.com example2@example.org example3@example.net - Sends an email to multiple addresses
  4. example@example.com example2@example.org 'Another Example User <example3@example.net>'

To send a message to another LizardMail address, specify their full LizardMail address - e.g., username [at] servername [dot] fastlizard4 [dot] org.

You will then be prompted for the subject of the message. Press enter after entering it. You can now type your message. Note that the message is plain-text only (no HTML). When you're done typing the message, add a blank line at the end of the message, then press <Ctrl>+<D>. You will then be prompted for CC's (carbon copies). Same format as the tolist, or just press enter if there are none. The message will then be sent. You do not need to re-enter your username or password, since you're already logged in to the server.

Before sending the message, you can abort it by pressing <Ctrl>+<C>,<Enter> twice.

Using In-Browser Webmail

LizardMail provides a convenient in-browser webmail service to allow users to send and receive emails. At the protocol level, the webmail system uses IMAP and SMTP (server-side), just like an email client (for example, Thunderbird, Microsoft Outlook, or Apple mail).

Simply navigate to https://webmail.fastlizard4.org to open the webmail program. Enter your SSH username and password (without any two-factor auth codes) in the indicated fields, and select the server you want to check your emails on from the dropdown menu. Once logged in, you will be able to send and receive emails.

Using an Email Client (e.g., Thunderbird, Microsoft Outlook, Apple Mail)

While this method is considerably more difficult to setup than the in-terminal method, it is much more robust, easier to use after setup, and allows you to properly read HTML emails, among other things.

To use this, you'll need an email client, such as Microsoft Outlook, Microsoft Outlook Express, Evolution Mail (Linux), or Mozilla Thunderbird (the one I use and recommend). This also works with your iPhone/iPod Touch and other smartphones.

Configuration

Configuration of email clients varies wildly, so you'll want to check your client's documentation to see how to perform the configuration. The settings you need to enter are given in the table to the right.


A Note About Combining Methods

Please note that combining the two methods for getting emails, Terminal and Email Client/Webmail, can cause some very strange things to happen. For example, deleting (or moving) a message from your Inbox using IMAP in your email client will actually leave the message in the inbox file (which the mail terminal command reads) with a special deleted flag that only IMAP understands. The gist of this is that the message will appear deleted (or moved) to your email client, while to the terminal mail command, the message is still there. You can partially fix this by enabling automatic expunging of your inbox in your email client (note that this isn't supported by all email clients, notably the iPhone/iPod Touch Mail app), although this will leave behind one special message ("DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA") that you should not delete or move. In addition, the message displayed when you login via SSH to the server will read "You have mail" or "You have new mail", the latter indicating that new mail has actually arrived. Actually new messages are marked with a N or a U in mail's message list. If you see the "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA" message, remember to note its ID number (usually 1) and to use the pre command on it (e.g., after opening mail, you see that the message's ID number is 1, so you enter the command pre 1 before anything else to preserve it).

It is therefore strongly recommended that you use one method or the other, but not both.

Note: You can also manually expunge folders within your client. Right-click the folder to expunge and look for an Expunge or Compact folder option (e.g., Thunderbird calls it Compact). Remember that this only has effect on IMAP.

Anti-Spam Features

LizardMail uses a combination of MIMEDefang and SpamAssassin (with Bayesian filtering) to defend against incoming spam. By default, if an incoming email appears to be spam, the subject is prefixed with *****SPAM***** and delivered to your inbox as with normal emails. However, it is possible to also have these emails automatically put into another folder to separate spam from regular emails, as with Gmail and other popular services. This isn't the default configuration because this mostly benefits users who use an email client to access their email over IMAP or POP3, or who use LizardNet's webmail. To set this up, follow the directions below:

  • Log in via SSH (this will need to be set up on each LizardNet server you have access to)
  • Create a file .forward in your home directory with the following contents:
"|IFS=' ' && exec /usr/bin/procmail || exit 75 #your-username"
  • ...Replacing your-username with your login username. Include the double quotes surrounding the entire line.
  • Create a file .procmailrc in your home directory with the following contents:
:0
* ^X-Spam-Flag: YES
/home/your-username/mail/Folder
  • Where your-username is again your login username, and Folder is the name of the mail folder you want to have spam placed automatically (case-sensitive!). Common choices for Folder will be Spamalot (the default spam folder created for every user on LizardNet SSH account creation) and Junk (the default spam folder created by many email clients, especially those made by Apple).
  • Done! Now, junk emails - in addition to having their subject lines prefixed with *****SPAM*****, will be automatically moved to the folder you specified.
Note: You may sometimes also see emails that - in addition to the *****SPAM***** prefix - have the text [SPF_VERIFICATION_FAILED_-_POSSIBLE_SPAM!!] also prepended to their subject lines. This indicates that the email failed Sender Policy Framework checks, and likely did not actually come from the address given as the "From:" address in the email.

Training the Spam Filter

The spam filter may occasionally make a mistake and classify an email as spam when it isn't, or classify an email as not spam when it actually is. If such mistakes happen, and you are using an email client over IMAP (not POP3) or LizardNet Webmail to check your email, you can take advantage of the easy training system.

IMPORTANT: The training system only works if you are using an email client over IMAP and/or LizardNet Webmail, and only if you have enabled automatic spam folder filtering as detailed in the section above.

This works in a manner similar to popular services like Gmail. If you come across an email that was marked as spam but is not actually spam, simply move it out of the spam folder into any other folder (except those named "Spamalot", "Junk", or "Trash") and it will be automatically marked as a not-spam email. Conversely, if you come across a spam email that was not marked as such, simply move it into your Spamalot or Junk folder to automatically train the spam filter that the email was, in fact, spam.

Important notes:

  • All training classifications may take up to 15 minutes to take effect.
  • If you accidentally classify a good email as spam, simply move the email back to its original folder to immediately reclassify it as a good email.
  • If you accidentally classify a spam email as good, you must wait a minimum of 15 minutes before moving it back to a Spamalot or Junk folder to reclassify it as spam (sorry, this is indeed a bit of a workaround to an odd problem).
  • Emails that contain [SPF_VERIFICATION_FAILED_-_POSSIBLE_SPAM!!] in their subject lines will always be marked as spam due to the way the SpamAssassin rules are written, no matter how you classify those emails.

Push Notifications

Using procmail, you can set up a push notification provider to receive an immediate push notification to your computer or phone as soon as an email is received. This works on all LizardMail-capable servers, though you'll need to set up push notifications individually on each server.

This guide is written for the Pushover service, which supports iOS, Android, and desktop (through the Chrome, Safari, and Firefox browsers, or through macOS directly). For each device type license (iOS, Android, and desktop), Pushover offers a 7-day free trial, after which a perpetual license costs $4.99 USD per device type (with an unlimited number of devices under each type). However, this guide should be fairly easily extendable to other push notifications services as well.

Before setting up procmail on the LizardMail servers for delivering push notifications, you'll need to register for pushover, install and set up the app on your device or in your browser, and create an application key for LizardMail.

To create the application key, log in to Pushover in your web browser. Before continuing, note your user key listed under Your User Key. Towards the bottom of the page, click Create an Application/API Token. Fill out the fields as you wish, selecting Script for the Type field. Once your application is created, you'll be shown an API key under API Token/Key - this is your application key.

Once you have your user key and application key, SSH into the server(s) that handle LizardMail for your LizardNet email address(es). The server you should SSH into is the same as the bit after the @ in your email address, with the exception of @fastlizard4.org addresses - for these, you should SSH into ridley.fastlizard4.org.

At this point, it is strongly recommended that you setup spam delivery filtering to avoid spam emails triggering push notifications, if you haven't already. Follow the steps under the Anti-Spam Features section above, then return here. This guide will assume that you have set up this spam filtering, which also sets up your account to use procmail for email delivery, which is necessary to use push notifications.

Now, open the .procmailrc file in your home directory. Immediately under the rule for routing spam emails to your spam folder, add the following:

:0 EWhic
| /usr/local/bin/email2pushover -H 'subject,from' -T 'Notification title' -t 'application key' -r 'user key'

...Replacing Notification title with some descriptive but short title to identify the notifications (for example, "New email: myemail@fastlizard4.org"; it is recommended to make this notification title unique for each LizardMail server you set up push notifications for), replacing application key with your Pushover application key, and replacing user key with your Pushover user key.

Specifically, what this procmail rule does is pipe a copy (the c flag; tells procmail to still continue with delivery of the email as normal) of the email's headers only (the h flag) to the email2pushover executable, waiting for the executable to finish running and ignoring any failures (the W flag), also ignoring any write failures to the pipe (the i flag), and all of this only if the previous rule (i.e., the spam filtering rule) did not match (the E flag). The email2pushover program itself is what processes the headers and sends the API request to Pushover; the source code for it can be found here.

Save the file, and you're done! All future (non-spam) emails will trigger an immediate push notification to your device. You can test the delivery of push notifications by sending an email to yourself (perhaps using the mail your-user-name command).

The Pushover app supports additional customization, such as do-not-disturb periods and encryption of the push notification contents between Pushover's servers and your device - look at the settings in the app and on their website for more.