User Tools

Site Tools


linux:smtp-tutorial

Email Basics and SMTP Tutorial

Date: Tue 27 Nov 2018

POP and IMAP: Receiving mail

  • POP: Ports 110 and 995

POP, the Post Office Protocol: Generally, email clients that use POP will download email to a local system (e.g. your laptop) and then delete the emails from the remote server.

  • IMAP: Ports 143 and 993

IMAP, the Internet Message Access Protocol: More flexible than POP. The default is to leave email messages on the remote server until the user explicitly deletes them. IMAP was designed to enable access to email from multiple email clients (e.g., email client on laptop, on desktop, and on phone, simultaneously).

SMTP: Sending mail

  • SMTP for sending mail: Ports 25, 465, and 587

SMTP, the Simple Mail Transfer Protocol: to route and deliver messages.

Key terms:

  • Mail Transfer Agents (MTA) -- e.g., Postfix
  • Mail Delivery Agent (MDA) -- retrieve email from remote server
  • Mail User Agents (MUA) -- e.g., email client

Install Postfix, an SMTP server

Check for and install any updates, and then install Postfix and mailx:

sudo dnf check-update
sudo dnf -y upgrade
sudo systemctl reboot           # new kernel update; reboot required
sudo dnf -y install postfix mailx

Enable Postfix on startup using systemd, and then start Postfix:

sudo systemctl enable postfix.service
sudo systemctl start postfix.service
sudo systemctl status postfix.service   # check its status

Test the SMTP connection:

telnet localhost 25
ehlo localhost
mail from: sean@localhost
rcpt to: sean.burns@uky.edu
data
Subject: this is my first email

Hi,

What's up? Let me know!

- root
.
quit

Then use mailx on sweb or sised. E.g.:

ssh user@sised
mail -s "hello there" other-user
linux/smtp-tutorial.txt · Last modified: 2019/01/21 11:28 by seanburns