SMTP Intro

Simple Mail Transfer Protocol

  • Application layer protocol
  • Used for the delivery of electronic messages (email)
  • Designed for text-only

Simple Mail Transfer Protocol Terms

  • MUA : Mail user agent
  • thunderbird, outlook
  • also called mail client
  • What does it allow you to do?

Simple Mail Transfer Protocol Terms

  • MTA: Mail Transport Agent
  • exim, postfix, exchange
  • tasked with sending the message to the recipient MTA
  • Use SMTP to transport

Simple Mail Transfer Protocol Terms

  • MDA: Mail Delivery Agent
  • exim, postfix, exchange
  • responsible for putting message in appropriate mailbox

Simple Mail Transfer Protocol Terms

  • Mail box: storage for messages
  • mbox, maildir, mSQL

Simple Mail Transfer Protocol Steps

Sending message to bob@thegummibear.com

Simple Mail Transfer Protocol Steps

Receiving message from alice@zero.cs.utahtech.edu

Our setup

SMTP MTA-Outgoing

  • Locate destination of message with DNS
    • find MX record
    • then A record (if we can't find MX)
  • Smart host
    • type of MTA that we can route through
    • can reduce spam
  • System mail name
    • follows the @ part of address
  • Relay only for self
    • protect from spam

SMTP MTA-Incoming

  • Publish MTA location via DNS
    • MX first
    • A second
  • Receive to public IP address
  • Identify hostname portion
    • after the @

How will we set it up?

  • Install Exim4
  • A combination MTA/MDA
  • Install mailutils
  • allow us to read
  • provides daemons for delivering and reading
  • pop3d, imap4d

Setup outline

  • reconfigure exim4-config
  • Add MX records to DNS
  • Send messages from server
  • Send messages to server
  • check logs
    • /var/log/exim4/
      • mainlog
      • rejectlog
      • paniclog
  • Test!!!

My Configuration

My Configuration

  • incoming: receive on our public ip and loopback
    • keep messages for @mail.thegummibear.com and @thegummibear.com
    • save messages in mbox format
  • Misc:
    • minimal dns: no
    • small config files: no

Spam prevention

Many email providers (such as gmail) will not recieve an email from a domain such as ours unless the email can be authenticated as coming from our server. At least one way to do this is by utilizing the SPF.

Sender Policy Framework (SPF)

SPF is a standard email authentication method. SPF helps protect your domain against spoofing, and helps prevent your outgoing messages from being marked as spam by receiving servers. SPF specifies the mail servers that are allowed to send email for your domain. Receiving mail servers use SPF to verify that incoming messages that appear to come from your domain were sent by servers authorized by you.

Sender Policy Framework (SPF)

Essentially we need to add a line like the following to our zone file:

@ IN TXT "v=spf1 mx ip4:144.38.192.231 a:stumail.cs.utahtech.edu ~all"
mail IN TXT "v=spf1 mx ip4:144.38.192.231 a:stumail.cs.utahtech.edu ~all"

Allows email from our domain coming from our mx server, that ip, or stumail.

Other fields are explained here