Mail and Sendmail and Friends

  1. Applicability

    1. Not for UUCP

    2. Applies for local-only

    3. Applies for direct internbet connection.

  2. What is email?

    1. Body -- The text the user typed in

      1. Normally 7bit ASCII

      2. Normaly an upper length imposed to avoid deniual of service attack.

    2. Header

      1. Machine generated

      2. Tells from, to, date, etc.

    3. Can be from programs as well as people and to programs as well as people.

  3. Mailer interface like elm, pine, mh.

    1. Lets user compose mail.

    2. Lets user read mail.

    3. Store mail into folders (good programs allow this).

    4. Handle mime attachments.

    5. Handle locl nicknames (not alias, that comes later).

  4. Mail addresses

    1. user means send to the local user

    2. user@host.domain means send to the user the the computer withing the domain.

    3. host1!host2!host3!user is very old style and going away.

  5. Mail routing

    1. Look up IP number using DNS (domain name service).

    2. If host has an MX record, send mail to the host instead,

      1. Used so that all mail goes to a central (reliable) site.

      2. If there are multiple MX records, use in low->high order.

    3. If there is no MX record, send to that host.

  6. Local delivery

    1. Mail goes in /var/spool/mail/username.

      1. Must be locked before mail can be appended.

      2. Append to spool file.

      3. Unlock.

      4. Admin must check spool files to make sure they don't get overlarge.

      5. Default for postfix

    2. Mail goes to /home/username/Maildir/*

      1. Each file is an email message

      2. Locking not as critical

      3. imap/pop servers need this

    3. Denial of service attack.

  7. How mail gets sent:

    1. User runs Mail Interface program and composes mail.

    2. M-I program runs sendmail (or equiv) on the text file it has just made.

    3. Postfix reads file for config options.

    4. If user is local

      1. Check for .forward file

      2. If found,

        1. send mail there

      3. else

        1. Put mail in appropriate file.

        2. Unlock.

    5. Else user is remote, so

      1. Look up IP number of remote host

      2. If there is an MX record, change target host to the the MX host and go back one step.

      3. Open socket to remote host

        1. If success, send the mail

      4. else

        1. queue the job

  8. SMTP (rfc link here)

    1. Is a protocol for sending mail.

    2. Works over socket #25

    3. Start with HELO

    4. MAIL FROM:username

    5. then RCPT TO: user2

    6. then RCPT TO: user3

    7. then DATA

    8. send lines of message

    9. finish with a period on a line by itself.

  9. Sendmail

    1. Sendmail quote ...

      It's been said that you aren't a real Unix system 
      administrator until you've edited a sendmail.cf
      file. It's also been said that you're crazy if 
      you've attempted to do so twice:-) 
      
      Sendmail is an incredibly powerful program. 
      It's also incredibly difficult to learn and
      understand for most people. Any program whose 
      definitive reference (Sendmail, published by
      O'Reilly and Associates) is 792 pages long 
      quite justifiably scares most people off. 
  10. Postfix

    1. Designed for security first, reconfigurability and speed second.

  11. Aliases

          1. Make new ones as needed.

          2. Format: cs495: randy skinny bob joe
            but NOT john@clarinet.uky.edu: john@nc.state.edu

          3. Run newaliases to update the database