Sat, 23 Dec 2006

postfix: delete all mail in the queue

    Easy way: as root, type -- postsuper -d ALL
                               postfix reload
    
Note:  this is a very powerful command as it deletes 
ALL mail in the queue.

## get the mail-ID and other junk in the first column
mailq | nawk '{print $1}' > tmp-mailq

## remove the junk line starting with (tra
## repeat as necessary if other junk lines are present
## repeat once also for blank lines
## manually edit to remove any other extraneous lines
cat tmp-mailq  | sed '/^(tra/d' > tmp-mailq-2
cat tmp-mailq2 | sed '/^$/d'    > tmp-mailq-3

## write a short script to loop through postsuper -d
## with the mail-ID's

   #!/bin/sh
   exec < tmp-mailq-3
   while read line
   do
      postsuper -d $line
   done

## run the script; mailq should be clean

Posted at: 13:01 | category: /mail | Comments ()

Mail Server Open Relay Check

1.  From the mail server, simply:

    telnet relay-test.mail-abuse.org

    and watch output.

2.  http://members.iinet.net.au/~remmie/relay/

3.  http://www.abuse.net/relay.html

Cheat sheet for configuring Postfix to stop UCE:

http://jimsun.linxnet.com/misc/postfix-anti-UCE.txt

Posted at: 12:59 | category: /mail | Comments ()

postfix

postcat msgID                   // read the message
postsuper -d msgID              // delete the message
postconf                        // print conf value on stdout
postfix check                   // check the config values
postfix reload                  // reload teh config files
mailq                           // check the queue
postfix flush                   // send all mail for delivery now

/var/spool/postfix/deferred     // where pending mail hangs out
/var/spool/postfix/defer

/var/log/mail.info              // log files to check
/var/log/mail.warn
/var/log/mail.err

Posted at: 12:59 | category: /mail | Comments ()

command line mail

:~ telnet 200.174.38.18 25
:~ HELO mydomainname_of_choice.com
:~ MAIL FROM: someone@yahoo.com
:~ RCPT TO: someone-else@msn.com
:~ DATA
:~    
:~ .
:~ quit

// command line mail from mutt
echo "my message" | mutt -s "my subject" -a Attach.tar someone@yahoo.com

Posted at: 12:59 | category: /mail | Comments ()

mairix


mairix -p -v -a -t	// -p purges empty holes left by deletions
			// -v verbose during indexing
			// -a augment the vfolder rather than write-over
			// -t return the entire thread in a successful search

mairix 	t:pointer	// To: header
	c:pointer	// Cc: header
	a:pointer	// To:, Cc: or From: headers
	f:pointer	// From: header
	s:pointer	// Subject header
	s:pointer=2	// allow up to 2 errors in subject keyword
	b:pointer	// message body
	d:3m-1m		// msgs between 3 mths and 1 mth ago
	d:-2y		// msgs older than 2 yrs
	d:2w-		// msgs within last 2 wks
	z:1m-		// msgs larger than 1 megabyte
	z:10k-20k	// msgs between 10k and 20k bytes
	p:/archive/	// msgs with /archive/ in their path

Example:	assume e-mail address richard@doesnt.exist

mairix d:3m- f:richard+doesnt+exist s:chrony

	// matches all msgs newer than 3 mths from richard and word chrony in 
	// the subject line

mairix d:6m- f:richard s:chrony=2

	// matches a wider range in the e-mail address, newer than 6 mths,
	// and allows up to 2 errors in the keyword in subject search

In Mutt, access mairix as follows:

	!		// open shell
	mairix f:kevin	// enter search criteria
	c=vfolder	// change folder to see results in vfolder

Make sure you run mairix -tp occasionally to update the DB.

Files:  ~/.mairixrc
	/usr/share/doc/mairix/mairix.html

Posted at: 12:59 | category: /mail | Comments ()