[Home]Tips/Mail

Scalene Wiki | Tips | Recent Changes |

1. Sendmail
2. SMTP
3. POP
4. IMAP

1. Sendmail

To rebuild access map (to block specific email addresses):
 sudo /usr/sbin/makemap hash /etc/mail/access < /etc/mail/access 
To rebuild sendmail.cf
 m4 cf.m4 my.mc > sendmail.cf 
To support additional domains (see http://www.sendmail.org/virtual-hosting.html):
  1. edit /etc/mail/sendmail.cw
  2. edit /etc/mail/virusertable
  3. run:
 sudo /usr/sbin/makemap hash /etc/mail/virusertable < /etc/mail/virusertable
To check mail delivery:
 /usr/lib/sendmail -bt
 ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
 Enter <ruleset> <address>
 >
To test the domain's presence in the mailertable:
 > /map mailertable angrysunguy.com
 map_lookup: mailertable (angrysunguy.com) returns esmtp:[fep.biz.rr.com] (0)
 > /map mailertable aol.com
 map_lookup: mailertable (aol.com) no match (0)

To test the domain's presence in the access database:

 > /map access to:angrysunguy.com
 map_lookup: access (to:angrysunguy.com) returns RELAY (0)
  > /map access to:aol.com
  map_lookup: access (to:aol.com) no match (0)


2. SMTP

A simple SMTP session:
 telnet mailhost 25
 HELO mailhost 
 MAIL FROM: someone@somehere.nz
 RCPT TO: root@mailhost
 DATA
 You are an idiot
 .

An SMTP-AUTH session (note that [=username] & [=password] are Base64 encoded strings):

 telnet localhost 25
 220 something.fake ESMTP Sendmail 8.12.11/8.12.11/SuSE Linux 0.6; Wed, 2 Apr 2003 15:13:01 -0700

 EHLO localhost
 250-something.fake Hello localhost [127.0.0.1], pleased to meet you
 250-ENHANCEDSTATUSCODES
 250-PIPELINING
 250-8BITMIME
 250-SIZE
 250-DSN
 250-ETRN
 250-AUTH LOGIN PLAIN
 250-DELIVERBY
 250 HELP

 AUTH LOGIN
 334 VXNlcm5hbWU6

 username
 334 UGFzc3dvcmQ6

 password
 235 2.0.0 OK Authenticated

 MAIL FROM: me@something.fake
 250 2.1.0 me@something.fake... Sender ok

 RCPT TO: you@nowhere.land
 250 2.1.5 you@nowhere.land... Recipient ok

 DATA
 354 Enter mail, end with "." on a line by itself

 This is a test
 .
 250 2.0.0 h12MD1qV026715 Message accepted for delivery

 QUIT

3. POP

Here is a simple POP session:
 USER jswank@somewhere.com
 +OK please send PASS command
 PASS mypassword
 +OK jswank@somewhere.com is welcome here
 LIST
 +OK 1 messages
 1 1339
 .
 QUIT
 +OK jswank@somewhere.com POP3 server signing off.

4. IMAP

Here is a simple IMAP session:
 A0001 CAPABILITY 
 CAPABILITY IMAP4rev1 NAMESPACE
 A0001 OK CAPABILITY completed
 OK CAPABILITY completed

 A0002 LOGIN "<username>" "<password>"
 A0002 OK LOGIN Ok.

 A0003 SELECT "INBOX" 
 FLAGS (\Answered \Flagged \Deleted \Seen \Recent)
 OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen)] Limited
 1 EXISTS
 1 RECENT
 OK [UIDVALIDITY 1014824955]
 A0003 OK [READ-WRITE] Ok

 A0004 SEARCH UNSEEN
 * SEARCH 1
 A0004 OK SEARCH done.

 A0005 FETCH 1 RFC822.SIZE 
 * 1 FETCH (RFC822.SIZE 780)
 A0005 OK FETCH completed.

 A0006 FETCH 1 RFC822.HEADER
 * 1 FETCH (RFC822.HEADER {756}
 Return-Path: <someone@somewhere.org>
 Delivered-To: username@domain
 A0006 OK FETCH completed.

 A0007 FETCH 1 BODY[TEXT] 
 * 1 FETCH (BODY[TEXT] {24}
 Just testing-- ignore.
 
 * 1 FETCH (FLAGS (\Seen \Recent))
 A0007 OK FETCH completed.

 A0008 LOGOUT 
 * BYE Courier-IMAP server shutting down
 A0008 OK LOGOUT completed

Scalene Wiki | Tips | Recent Changes |
This page is read-only | View other revisions
Last edited August 10, 2006 7:27 by Jason (diff)
Search: