Currently, we are using sendmail to handle email. There are a number of tricky issues that appear because we have multiple machines redirecting email to one machine.

Installation

Linux Installation

See https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-email-mta-sendmail.html
  1. yum install sendmail
    yum install sendmail.cf
    
  2. Make sure that sendmail is running. See https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-email-mta.html
    [root@moog etc]#  alternatives --config mta
    
    There are 2 programs which provide 'mta'.
    
      Selection    Command
    -----------------------------------------------
       1           /usr/sbin/sendmail.postfix
    *+ 2           /usr/sbin/sendmail.sendmail
    
    Enter to keep the current selection[+], or type selection number: 2
    
    I also had to do
    /etc/init.d/postfix stop
    /etc/init.d/sendmail start
    
  3. Verify that sendmail is running:
    [root@moog etc]# telnet localhost 25
    Trying ::1...
    telnet: connect to address ::1: Connection refused
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 moog.eecs.berkeley.edu ESMTP Sendmail 8.14.4/8.14.4; Mon, 15 Oct 2012 11:24:39 -07
    00
    expn root
    expn root
    502 5.7.0 Sorry, we do not allow this operation
    quit
    quit
    221 2.0.0 moog.eecs.berkeley.edu closing connection
    Connection closed by foreign host.
    
      ~www/php/etc/sendmail-moog.mc is the .mc file that is used to update /etc/mail/sendmail.cf.
      cd /etc/mail/
      cp ~www/php/etc/sendmail-moog.mc sendmail.mc
      m4 sendmail.mc > /tmp/sendmail.cf
      diff sendmail.cf /tmp/sendmail.cf 
      
      Once you are happy with the changes between the old sendmail.cf and the one in tmp:
      mv sendmail.cf sendmail.cf.bak
      cp /tmp/sendmail.cf .
      
      Note that /etc/mail/sendmail.mc tends to get read often, so resist the urge to directly edit /etc/mail/sendmail.cw
    1. Other files to inspect in /etc/mail are access, aliases, local-host-names (used to be sendmail.cw).
    2. To restart:
      service sendmail restart
      
    3. To test, try telneting and expanding trustlocal@trust.eecs.berkeley.edu
      root@moog mail]# telnet localhost 25
      Trying ::1...
      telnet: connect to address ::1: Connection refused
      Trying 127.0.0.1...
      Connected to localhost.
      Escape character is '^]'.
      220 moog.eecs.berkeley.edu ESMTP Sendmail 8.14.4/8.14.4; Mon, 15 Oct 2012 15:16:48 -07
      00
      expn root
      250-2.1.5 
      250 2.1.5 
      expn trustlocal@trust.eecs.berkeley.edu
      250 2.1.5 <"|/home/mailman_4/mail/wrapper_4 post trustlocal">
      quit
      
      221 2.0.0 moog.eecs.berkeley.edu closing connection
      Connection closed by foreign host.
      [root@moog mail]#
      
    4. Then test that telnet moog.eecs.berkeley.edu 25 works. If it does not, try:
    5. The next step is Install Mailman.

    Solaris Installation

    Old, from 2008.
    1. As root, save the old configuration and binary
      mkdir /etc/mail/old
      cp -p /etc/mail/* /etc/mail/old
      cp -p /usr/lib/sendmail /usr/lib/sendmail.MMDDYY
      
      
    2. Create the smmsp user and group.
      echo "smmsp:x:25:25:Sendmail Daemon:/nonexistent:/usr/sbin/noshell" >> /etc/passwd
      echo "smmsp:*LK*:11406::::::" >> /etc/shadow
      echo "smmsp::25:" >> /etc/group
      
    3. Download the latest version from ftp://ftp.sendmail.org/pub/sendmail
    4. Untar it
    5. As yourself, build it: cd sendmail-8.xx.xx; sh Build
    6. If you get
      Undefined                       first referenced
       symbol                             in file
      dbm_pagfno                          map.o
      dbm_dirfno                          map.o
      
      then temporarily move /usr/local/include/ndbm.h and re run sh Build.
      You might find it necessary to remove the sendmail source directory, untar and rerun sh Build
      Don't forget to move ndbm.h back
    7. If you are upgrading and already have a working sendmail.cf, you can save the old sendmail binary, install the new sendmail and then restart:
      mv /usr/lib/sendmail /usr/lib/sendmail-X.Y.Z
      chmod 0000 !$
      make install
      /etc/init.d/sendmail stop
      /etc/init.d/sendmail start
      
      Then use mconnect to verify that the new version is running, and use Mail -v user@hostname to verify that mail works. If you are not updating sendmail.cf then you are done.
    8. If you don't have a working sendmail.cf or would like to update it anyway, then the next step is to set up /etc/mail/sendmail.cf by editing sendmail.mc and running m4 on it.
      /usr/cluster/etc/mail/sendmail-andrews.cf is the sendmail configuration file for andrews.eecs, which masquerades as chess.eecs, embedded.eecs and trust.eecs. Links in /etc and /etc/mail point to it. sendmail-andrews.cf is generated from /usr/cluster/etc/mail/sendmail-andrews.mc by running a makefile rule which runs a m4 command in the cf/cf directory of the sendmail distribution.
      cd cf/cf
      m4 ../m4/cf.m4 /usr/cluster/etc/mail/sendmail-andrews.mc > /usr/cluster/etc/mail/sendmail-andrews.cf
      
      Or
      cd cf/cf
      ln -s /usr/cluster/etc/mail/sendmail-andrews.mc sendmail.mc
      sh ./Build sendmail.cf
      
      Then run diff to compare the generated
      sendmail.cf
      file with the old one:
      diff /etc/mail/sendmail.cf sendmail.cf
      
      If there are no changes, then you can go ahead and install the new sendmail.cf (see below).
    9. andrews.eecs uses /usr/cluster/etc/mail/sendmail.cf which is derived from andrews.mc. The makefile includes a rule to update it too.
      The Bennett cluster machiens all share the same .mc file. On bennett cluster, or on source.eecs, do
      cd cf/cf
      ln -s /etc/mail/sendmail.mc .
      # edit /etc/mail/sendmail.mc
      sh Build sendmail.cf
      
      Then compare the sendmail.cf that was created with /etc/mail/sendmail.cf:
      diff /etc/mail/sendmail.cf sendmail.cf
      
      If there are significant differences, then you will need to adjust sendmail.mc accordingly and repeat running sh Build sendmail.cf When you are happy with the outcome, do
      sh Build install-cf
      
    10. As root copy the new version of sendmail and fix the permissions:
      cp obj.*/sendmail/sendmail /usr/lib/sendmail
      chmod u+s,g+s /usr/lib/sendmail
      chgrp smmsp /usr/lib/sendmail
      

    gigascale.org

    We would like email to appear that it is coming from gigascale.org instead of gigascale.eecs.berkeley.edu. The way we do this is that we have a MX record set up in the name server that points mail traffic destined to gigascale.org to gigascale.eecs.

    Spam defenses

    /usr/cluster/etc/mail/access contains the hosts we relay from and the domains and users we are rejecting email from. Update this file as root, and then run make to update access.dir and access.pag. I'm not sure if it is necessary to restart sendmail, but I don't think it is.

    To handle double bounces, try setting DoubleBounceAddress to nobody in sendmail.cf:

    # where do errors that occur when sending errors get sent?
    # Try googling sendmail redirect spam bounce                                    
    O DoubleBounceAddress=nobody
    
    Then in /etc/mail/aliases:
    nobody:    /dev/null
    

    Virus Scanning

    Once Sendmail is installed, see What was done to install InterScan VirusWall on gigascale?