WeeSan Lee
Roadmap Introduction Mail System Architecture Headers Sendmail Debugging Aliases Forwarding Procmail Q&A
Introduction MTA (port 25) MSA (port 587) MUA Eudora MUA pine MUA mail The Internet MTA (port 25) LDA procmail Message store MUA mail MUA pine AA Imapd, pop3 MUA Outlook
Introduction (cont) A mail system consists of: MUA – Mail User Agent Lets users read and compose , eg. Mail, Pine, Eudora, Outlook MTA – Mail Transport Agent Routes s among machines, eg. Sendmail, Postfix Speaks SMTP (Simple Mail Transport Protocol) MSA – Mail Submission Agent Accepting s from MUA, eg. Sendmail LDA – Local Delivery Agent Places s to a local message store, eg. Procmail /var/spool/mail/username AA – Access Agent Connects MUA to message store, eg. POP3, IMAP Question: What are the differences between POP3 and IMAP?
Mail System Architecture Incoming SMTP server For accepting incoming s with spam filters Outgoing SMTP server For sending outgoing s IMAP or POP3 server For retrieving s Message Store /var/spool/mail/username /home/username/mail/INBOX
Header Attribute: value Eg. From: Bcc: Header starts with X- will be ignored, eg. X-Spam-Flag: YES Body 7-bit ASCII text Question: How are binary data sent over s?
Sendmail Both a MTA (port 25) and MSA (port 587) Configuration file /etc/mail/sendmail.cf Mail queue /var/spool/mqueue/
Debugging mail $ cal | mail -s “test” sendmail -oi -t $ cat | sendmail -oi –t From: To: Subject: Hi Bill Linux is better -WeeSan ^D
Debugging (cont) telnet $ telnet mail.cs.ucr.edu 25 … 220 esmtp.cs.ucr.edu ESMTP Postfix mail from: 250 Ok rcpt to: 250 Ok data 354 End data with. Subject: Hi Bill Linux is better :) . 250 Ok: queued as F1C832AFBE4 quit 221 Bye Connection closed by foreign host.
/etc/aliases or /etc/mail/aliases Allows users to be referred by multiple names Used by mailing list $ cat /etc/aliases | grep weesan root: weesan, To rehash aliases $ newaliases
~/.forward $ cat ~/.forward \weesan
~/.procmailrc # For spam :0 * (^Subject:.*\[SPAM\]|X-Spam-Flag: YES) INBOX.spam # Another type of spam :0 * /dev/null
~/.procmailrc # SMS myself :0 c * | (formail -c -XFrom: -XSubject: ; echo "To: $MY_CELL") | $SENDMAIL -oi -t
~/.procmailrc # UCR Systems support s :0 * ^Subject:.*(New Ticket|Ticket Assigned) { :0 c INBOX.systems :0 | (formail -c -XFrom: -XSubject: ; echo "To: $MY_CELL") | $SENDMAIL -oi -t }
Reference LAH Ch 18: Electronic Mail