Mail

From CSCWiki
Jump to navigation Jump to search

Mail services are currently handled by the mail container on xylitol.

Reading your mail

You can use any user agent that supports maildir locally (mutt, alpine, etc), and any client that supports IMAP either locally or remotely. We also have webmail.

Here are the details:

  • maildir
    • Location: $HOME/.maildir/
  • POP3
    • No longer supported.
  • IMAP
    • Hostname: mail.csclub.uwaterloo.ca
    • Port: 143 (IMAP), 993 (IMAPS)
  • SMTP
    • Hostname: mail.csclub.uwaterloo.ca
    • SSL encryption and authentication required
    • Port: 25, 465, or 587

Mail User Agents

Here are instructions on how to access your CSC email using some common Mail User Agents (a.k.a. "email clients").

Apple Mail

Open the Mail app. On the Menu Bar, click on 'Mail', then 'Add account'.

Apple mail select account provider.png

Select 'Other mail account', then 'Continue'.

Apple mail add a mail account.png

Fill in your real name, your CSC email address (should be watiam_id@csclub.uwaterloo.ca), and your CSC password. Click 'Sign in'.

Apple mail imap details.png

You will get an error saying 'Unable to verify account name or password'. Fill in the details as shown above, then click 'Sign in'. Make sure to specify your WatIAM username as the username, and use mail.csclub.uwaterloo.ca for the incoming/outgoing mail servers.

Apple mail select apps to use with account.png

Finally, check 'Mail', and click 'Done'.

Apple mail mailboxes button.png

If you had an existing Mail account, you will need to click on the 'Mailboxes' button to see your CSC account. There will be a dropdown button beside 'Inboxes' on the left hand side where you can toggle between different inboxes.

Windows Mail

Note: Windows Mail can be very slow some times. I have no idea why. If you're looking for a decent email client on Windows, I strongly suggest using Thunderbird or Evolution instead.

Open the Mail app (as of this writing, 2021-04-23, its icon is a blue envelope). Click on 'Accounts' on the left hand side, then click on the '+ Add account' button. Select 'Advanced setup':

Windows mail choose account type.PNG

Then choose 'Internet email':

Windows mail advanced setup type.PNG

Here are some of the settings you'll need (replace your username, address, etc.):

Windows mail internet account info 1.PNG

Here are the rest:

Windows mail internet account info 2.PNG

Then click 'Sign in'. It may take you a very long time to connect for the first time, especially if Windows is doing one if its dreaded updates in the background. If it's still hanging after a few hours, it might be a good idea to close the window and try again.

Once you're signed in, you should be able to see your CSC account in the Mail app on the left hand side.

Gmail (SMTP Relay)

It is possible to link third-party email accounts to Gmail. Here's one way to do it.

Login to Gmail, go to Settings, and then under 'Accounts and Import', click 'Add another email address'.

Gmail settings accounts 1.png

Fill in your real name and CSC email address (should be watiam_id@csclub.uwaterloo.ca). I would suggest unchecking the 'Treat as an alias' box unless you want your CSC and Gmail addresses to be treated the same. See more info here.

Gmail add another email address you own.png

Fill in your CSC username and password:

Gmail add account credentials.png

Google will send a confirmation email to your CSC address. Either click on the link in the email or enter the confirmation code.

Gmail add address confirmation.png

If you return to Gmail, you should now see your CSC account under your settings. I suggest selecting the 'Reply from the same address the message was sent to' option.

Gmail settings accounts 2.png

Now, if you click on the 'Compose' button on the left hand side, you should be able to select your CSC address as the sender.

Gmail choose sender.png

If you want to receive your CSC messages via Gmail, just append your Gmail address to the end of the .forward file in your home directory on the CSC servers (it needs to be on a new line).

Outlook Desktop

This is probably the world's most powerful email client, but you need to jump through a lot of hoops to setup your CSC email with it. Luckily I've done those for you so just follow these steps:

Ol1.png

Open Outlook and click File at the top left.

Ol2.png

Click Account Settings and then Manage Profiles.

Ol3.png

Click Email accounts...

Ol4.png

Click New...

Ol5.png

Enter your name, CSC email and password. If you have an email alias, don't use your alias, use your QuestID@csclub.uwaterloo.ca email. Click Next >

Ol6.png

It will start searching for your account, this can take a minute or two.

Ol7.png

Once it finishes configuring it you'll get a test email.

Ol8.png

Uncheck Set up Outlook Mobile on my phone (unless you want to), and check Change account settings. Then click Next >

Ol9.png

If you have an email alias, you can now change your email to that in the Email Address field. Don't change your logon info. You can click More Settings to change your mailbox name, or click Finish (setup is complete).

Ol10.png

You can change the name here. That's it. I've provided the other two tabs' configs below just in case anyone (including future me) needs it.

Ol11.png Ol12.png

Gnus

Gnus is one of the MUAs built into GNU Emacs. Gnus is very powerful and flexible, and comes with several "backend"s out of the box for reading newsgroups, email, RSS feeds, and more. Over the years people have written many other backends for it as well.

To get started using Gnus for reading your CSC mail over IMAPS, you can start with the following simple configuration based on Gnus's nnimap backend:

(setq mail-user-agent 'gnus-user-agent
      read-mail-command 'gnus
      gnus-select-method '(nnnil "")
      gnus-secondary-select-methods
      '((nnimap "csc"
                (nnimap-stream tls)
                (nnimap-address "mail.csclub.uwaterloo.ca")
                (nnimap-user "abandali"))))

The gnus-secondary-select-methods variable set above is the most important bit.

For reference sake, here's how we can do client-side mail splitting in Gnus: say we want to move all messages with a X-Spam-Flag header of YES to the Junk folder; here's how we tell Gnus to do that:

(setq gnus-secondary-select-methods
      '((nnimap "csc"
                (nnimap-stream tls)
                (nnimap-address "mail.csclub.uwaterloo.ca")
                (nnimap-user "abandali")
                (nnimap-inbox "INBOX")
                (nnimap-split-methods 'nnimap-split-fancy)
                (nnimap-split-fancy
                 (|
                  ;; move spam to Junk
                  ("X-Spam-Flag" "YES" "Junk")
                  ;; catch-all; leave everything else in inbox
                  "INBOX")))))

Gnus has a plethora of useful and complex features, and one cat get very fancy with it. But that is left as an exercise for the interested reader. :-)

Spamfiltering

SpamAssassin is run on all incoming mail, but no action is taken based on the results. The results are appended to the headers of the email, so you can take action on it. We are running a shared Bayesian learner for all users' email, so there stands a chance of you not receiving legitimate mails due to false positives.

To use your own Bayesian learner instead of the site-wide one, simply add the following to ~/.spamassassin/user_prefs:

bayes_path ~/.spamassassin/bayes
bayes_auto_learn 1

Alternatively, to disable Bayesian tests altogether:

use_bayes 0

You can configure procmail (the application that postfix calls to deliver any mail that it received to the user that it was sent to) to place a message in a special folder and/or delete it based on its spam score and/or whether it got flagged as spam or not. In order to do this, you need to configure procmail via .procmailrc in your home directory. An example such .procmailrc is below (adapted from here):

SHELL="/bin/bash"
DELIVER="/usr/lib/dovecot/deliver -d $LOGNAME"
DEFAULT="$HOME/.maildir/"
MAILDIR="$HOME/.maildir/"
LOGFILE=$MAILDIR/procmail.log
LOGABSTRACT=all
VERBOSE=off

# send spam to Trash folder
:0 w
* ^X-Spam-Status: Yes
| $DELIVER -m Trash

The folder to which the messages are sent must exist first. To create a new IMAP folder in the Roundcube web client, click on the gear icon in the lower left corner.

Technical Details

Mail Transfer (Incoming)

Postfix is our MTA and runs on mail. Incoming mail is received inbound on smtp/25 or ssmtp/465 and goes through a sequence of filters before being delivered to users.

We are using the following filters for incoming mail, to combat spam and malware:

  • zen.spamhaus.org RBL
  • Greylisting with postgrey

These filters reject truckloads of spam, preventing them from reaching your inbox. Greylisting adds a delay to mail delivery from unknown servers, but after a small number of successes they will be auto-whitelisted. If that isn't good enough, ask systems-committee@csclub.uwaterloo.ca to whitelist all mail to your address.

Mail Delivery

User mail is delivered, by default, to procmail. This is configurable by adding a comma-separated list of destinations in $HOME/.forward. See aliases(5) for more details.

Procmail, in turn, writes mail to $HOME/.maildir unless instructed otherwise. You can customize procmail by editing $HOME/.procmailrc. See procmailrc(5) for more details.

Failures

If you are out of quota or another error occurs writing to your home directory, procmail will deliver your message to /var/mail/$USER on the mail server. If that too fails, the server is probably on fire. The message will be returned to the queue where it will eventually bounce.

Forwarding

Place the following in $HOME/.forward to keep a local copy of your mail as well as forward it to some other email account. Replace ctdalek with your CSC username, but make sure the backslash stays.

\ctdalek
calumt@dalek.com

Mail Retrieval

We run Dovecot, an IMAP server. It reads messages from $HOME/.maildir, so if you have procmail deliver your mail elsewhere you will be unable to retrieve your mail using IMAP.

Mail Submission (Outgoing)

On the mail container, outgoing mail is submitted directly to Postfix via the sendmail(1) wrapper or on submission/587. Submitted mail is then queued for delivery to its destination. The other systems have no MTA and instead run sSMTP, which relays mail through the mail container immediately without any queue or daemon.

Syscom

Postgrey whitelists are in `/etc/postgrey` on mail.