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