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 ()

clam antivirus

clamscan -r -l scanned.txt /home/kevin 
    // scans /home/kevin recursively and writes results to scanned.txt

www.eicar.com       //  get a harmless test virus here

FILES:

    /etc/cron.d/clamav
    /var/log/clam-update.log
    /usr/bin/clamscan
    /usr/bin/freshclam
    /usr/bin/sigtool

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

bogofilter

bogoutil -d old | bogoutil -l new    // compacts the DB

cat msg | bogofilter -Ns    // if not spam, run this to 
                            // remove from spam DB and
                            // add to non-spam DB

cat msg | bogofilter -Sn    // if spam, run this to remove 
                            // from non-spam DB and add
                            // to spam DB

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

Command Line Email Reading




telnet your.pop.server 110

eg. My email address is manages@cse.mrt.ac.lk , therefore my POP server is cse.mrt.ac.lk

Now let's go through the following sample telnet session. You will get to know the commands and their usage as we progress. After you have connected to the POP server, a message similar to the below will appear. Let's continue from there.

+OK sigiri POP3 Server (Version 1.004) ready.

USER manages

Use your login name instead manages, don't use mine.

+OK please send PASS command

PASS mypassword

 Use your email password, not mine.

+OK 2 messages ready for manages in /usr/spool/mail/manages

Note: Unlike most times when you enter your password, this time you will see it as you enter it. Please make sure that no one is staring at your screen over your shoulders.

list This will display the total number of messages and size again as well as a list with each file number, a space and its size. something similar to the following:

+OK 2 messages; msg# and size (in octets) for undeleted messages:

1 607
2 1323403
.

retr 2 Displays the message-2 including headers.

top 1 20 Displays the first 20 lines of the message-1. Unlike the retr command, this will not scroll the message to the end . It just shows the first 20 lines of the message body. This is useful if you want to read the whole message. The syntax of the retr command is

retr messageNo NumberOfLines

dele 2 Deletes the message-2. This is how you delete a message. You will see the confirmation for the deletion. In fact the message-2 is a mail bomb, you can identify it from the size. It is rather unusual to have a legitimate message of over 1MB.

+OK message 2 marked for deletion

If you type list again, you will see that message number 2 is indeed gone.

There are few more commands I have not discussed, the best way to learn them is to issue an incorrect command.

blah

-ERR Invalid command; valid commands: DELE, HOST, LAST, LIST, MBOX, NOOP, RETR, RSET, STAT, TOP or QUIT

Now you can play with the rest of commands. Note that some POP servers do not give this error message.

quit ends your session. Simply closing the telnet session may hang your mailbox.



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

Delivery of each email is done
by your ISP mail server, first establishing a conversation
through (port 25) of each of your recipient ISP mail server

 


How email works?

How does my email gets to the recipient?

Before you can send out email messages from your PCs, you need to access the Internet through your ISP network via a dial-up modem that usually utilizes the telephone line or with always-on ISDN, DSL, ADSL, Network or Cable connection.

SMTP (Simple Mail Transport Protocol) is a protocol governing electronic mail transmission and reception. It is used for sending email to and between mail servers (sending and receiving email messages). See rfc 821

Using email clients like: Outlook Express or Eudora etc. to send out email to your ISPs mail server--which collects them--put them in queue and then relay them to your recipients ISP mail server--for retrieval from their mailbox.

Mailbox - each mailbox is assigned a unique address ie: mymail@mydomain.com character string which identifies the user to whom the mail is to be sent. Mailboxes normally reside on mail servers that are always connected to the Internet (otherwise mails can't be received), and mails are fetch from the remote mail servers using Post Office Protocol (POP3) by the user with their mail client.

Email in queue at your ISP mail server may takes just a few seconds to be delivered--if it is not overloaded--to a few minutes or even hours, and if the network is down or the recipients mail server does not want to accept your email for some reason like: busy or mailbox full--then your ISP or your own mail server will try to deliver again...

 

 

SPAM
driving
you crazy?
In a few minutes time, you will have the easiest & most powerful way to stop it... Click here
for more info
 

Freeware

Auto-manage smtp pop3 bounce email Click here
for more info?

 


Many ISP (or your)
mail servers can be programmed to make multiple attempt delivery of undelivered email, some up-to 250 times before returning them as undeliverable.

In many countries, local legislation requires ISP service operator to grant security service access to the users correspondence--so, your emails are probably stored in your ISP's system for some time before being delivered.

MailsBroadcast send emails continuously in groups of 10 (default setting) or up to 250 emails per group to your ISP mail server or to your PCs mail server for distribution -- as fast as your ISP or mail server can cache them for distribution. Therefore, the speed of sending emails is not due to the MailsBroadcast program.
See
Email Speed

If you sent 500 emails to your ISP mail server, it will accept all (store them) and put them in queue for delivery or you may experience server-time-out (connection terminated) because many ISP mail server are programmed to limit the amount of mail that you can sent, by quantity or by limiting the server access time.

Server-time-out, if the sending and receiving mail server have different timeouts, one of them may give-up while the other is still trying and unexpectedly, terminate the connection.

Many ISP mail servers also reduce the number of concurrent connection--meaning that even thought your ISP mail server have accepted all your emails--they may not be delivered or accepted by the intended recipient ISP mail server. See: Server-time-out and identifying mail delivery failures... See: SMTP Return Error Codes

Assuming that all your 500 emails are sent to different domain recipients, for example: july_@aol.com  march_@mail.com  may_@hotmail.com etc., your ISP mail server will have to deliver each of your 500 emails to 500 different ISP mail servers...

 

 

 

 

 

 

 

 

 

 

 

 

To top of page

 


 


The Conversation

How two MTAs (Message Transfer Agent) communicate with each other using a single TCP connection?

After your ISP mail server have collected all your emails, put them in queue and then send them out--to each recipient ISP mail server by establishing a conversation with a SMTP server--connecting to port 25 on the recipient SMTP mail server and wait for it to identify itself first....

...the recipient mail server will tell the sending server if it is prepared to receive mail--if not--the sending mail server terminate the connection and try again later...

...after a predetermined undeliverable attempts, all undeliverable message will be returned (rfc 821) with an error report containing the first part (message headers) to the sender mail server.

Server-time-out, if the sending and receiving mail server have different timeouts, one of them may give-up while the other is still trying and unexpectedly, terminate the connection.

Basically, email consist of:
(1) The envelope   (2) headers   (3) Message body

(1) Envelope
rfc 821 specifies the contents and interpretation of the envelope--used by the MTAs for delivery specified by these two SMTP commands (MAIL From: and RCPT To:)

MAIL From:<mable@sun.tuc.test.org>
RCPT To:<mable@test.org>

(2) headers are used by the user agent and each header field contains a name, followed by a colon, followed by the field value.
Received: by sun.tuc.test.org. (4.1/SMI-4.1)
id AA01301; Tue, 21 May 98 11:37:22 MST

Message-Id: <6210181836.AA00502@sun.tuc.test.org.>
From: mable@sun.tuc.test.org (Mable Merliney)
Reply-To:
mable@test.org
X-Phone:
+0 202 671 2761
X-Mailer:
Mail User’s Shell (9.1.0 12/02/98)
To:
mable@test.org
Subject:
testing

Headers beginning with an X- are user-defined fields and RFC 822 specifies the format and interpretation of the header fields.

(3) Message body is the content of the message from the sender to the recipient and transferred using the DATA command--the headers are sent first, followed by a blank line, followed by the body. Each line transferred using the DATA command must be less than 1000 bytes.

The user agent takes what the sender specify as a body, adds some headers and passes the result to the MTA
The MTA adds a few headers, adds the envelope and sends the result to another MTA.

 

Operational Sequent of:
SMTP
Simple Mail Transfer Protocol

A HELO command and recipient mail server identify its self--at this stage--it may decide to terminate the connection--if it don't want to talk to the sender for example: mailbox full or blocked, etc., if it is accepted...

A Mail-FROM command is issued by the sender mail server, followed by the from (sender) address--again, the mail server may decide to terminate the connection, if it does not wish to receive mail from the sender...

...at this stage, most mail servers will conduct a reverse lookup nslookup on the domain name specified for the HELO or FROM command and if the IP address of the sender mail server is not registered (see MX records) to that domain--considered an (imposter) non-local--the connection terminated and if it is accepted...

A RCPT-TO command is issued, followed by the email address of the intended recipient--at this point, the mail server may reject emails sent to the specified address, ie; non local user--if all goes well at this stage, your ISP mail server may issue multiple RCPT-TO commands to the server thus adding more recipients to the message:

adding more--means that, if you have 100 AOL email recipients, all of them are all delivered to the mail server. When it is through with adding recipients, it issues the...

DATA command to the server and if it is accepted ....at this point--again, the mail server may reject emails being delivered...

DATA command is accepted and your ISP mail server proceeds to send the message headers, followed by a blank line, followed by the message body and file attachment data. When it is done with sending the message data, it sends a carriage return, followed by a period, followed by a carriage return, to indicate the end of the message...

QUIT command is issued to terminate the conversation If you have sent 500 emails and all of them are to 500 different email domain, the above process is repeated with each and every 500 different ISP mail server.

Email Daemon - An email software program residing in a mail server that manage incoming and outgoing mails.

If your are sending emails using your own mail server program. Emails will first be sent from your email client to your mail server for delivery and if you are off-line (not connected to the Internet) your mail server will cache or store them in queue for delivery--And follow the same SMTP protocols as described above it makes no difference, whether it is your own mail server or your ISPs mail server.

How two MTAs (Message Transfer Agent) communicate with each other using a single TCP connection. A typical transcript conversation between two mail server (below). SENDER in bold and the 5 SMTP email transaction commands. 220, 250, 345? See: SMTP Return Codes

 


 

 

 

 

 

 

 

 

 

To top of page

 

 

 

 

 

 

User Agent?
A program (ie: Eudora) or editor that let users create, edit, compose, store and send mails to a mail server, polls a mail server for mails, download and display mails, as well as using
POP3 to talk to mail servers.


 

 

 

Message Transfer Agent (MTA) the exchange of mail using TCP/IP is performed by MTA that defines how email messages are transmitted between two users.
 
220 mailhost.immxx-isp.com ESMTP Sendmail 8.8.5/1.4/8.7.2/1.13; Tue, Mar 18 1997 14:38:58 -0800 (PST)

HELO mail.sender.org
250 mailhost.immxx-isp.com  Hello mail.sender.org

 

 

 


MAIL FROM: antispam@sender.org
250 antispam@sender.org... Sender ok

 

 

 



RCPT TO: myfriend@immxx-isp.com
250 myfriend@immxx-isp.com... Recipient ok

 

 


DATA
354 Enter mail, end with "." on a line by itself
Received: from alpha.sender.org (alpha.sender.org [124.211.3.11]) by mail.sender.org (8.8.5) id 004A21; Tue, Mar 18 1997 14:36:17 -0800 (PST)
From: antispam@sender.org (Anti-Spammer)
To: myfriend@immxx-isp.com
Date: Tue, Mar 18 1997 14:36:14 PST
Message-Id: <antispam031897143614-00000298@mail.sender.org>
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
Subject: Meeting this evening?
Let's go to the movie after dinner?


--antispam.
250 LAA20869 Message accepted for delivery

QUIT
221 mailhost.immxx-isp.com closing connection



Example of undeliverable notification
in respond to a message send by
john@MAIL  via  mail2  to  mail3  with
relay instructions to mail4

S: MAIL FROM:<>
R: 250 ok
S: RCPT TO:<@MAIL2.ARPA:JOHN@MAIL.ARPA>
R: 25O ok
S: DATA
R: 354 send the mail data, end with .
S: Date:  23 Nov 19  10:21:23
S: From: SMTP@MAIL3
S: To:     JOHN@MAIL.ARPA
S: Subject: Mail System Problem
S:
S: Sorry JOHN, your message to ANN@MAIL4.ARPA lost
S: MAIL4.ARPA said this:
S: "550 No Such User"
S:
R: 250 ok

 

 

HELO
command, identifies the sending mail machine;
HELO mail.sender.org to the receiving mail machine...

and receiving mail machine to the sending machine;
250 mailhost.immxx-isp.com  Hello mail.sender.org

At this initial stage NO transaction takes place, the receiving machine can terminate the process with a 501 failure reply and the sending machine will try again or return the mail as undeliverable.
At the
HELO command, the sender can lie, nothing can prevents mail.sender.org from saying HELO makemoney.gov that's how spammers fake and mask their message headers.

--------------------------------------------------------

MAIL FROM
command, initiates mail processing and the address given turns into From: antispam@sender.org--the sender email can be valid, invalid or fake--in short; the sender can use just about any email

This is where
most mail servers will conduct a nslookup on the domain name specified for the HELO and FROM --if the sender machine IP address is not registered (see MX records) to that domain--will be considered an imposter or non-local--the connection terminated.
At this stage, the receiving mail machine can terminate the process, the sending machine will try again or return the mail as undeliverable.
----------------------------------------------------------------------------------

RCPT TO command, specifies and identify the intended recipient of the mail myfriend@immxx-isp.com and the given address becomes the To: that determines who the mail will be delivered to, regardless of what the To: line in the message says--at this point, the mail server can still reject the mail. RCPT TO is also used to identify multiple recipients within the same domain by multiple use of this command and if the mail contains a forward path (FW to someone not local) and if the receiving machine do not allow relay the mail will be returned as: 550 Unknown local user
-------------------------------------------------------------------------------

DATA command, starts the mail input and the receiving machine must process the transaction, store the mail and send an OK reply to the sending machine. If the the transaction failed (at this point) the receiving machine must send a 503 encountered bad sequence of commands failure reply to the sending machine.

When the receiving machine accepts a message either for relaying or for local delivery, it inserts a time line to indicates the identity of the host that send the mail and the host that receive the mail. (Relayed mails will have multiple time lines.
Received
: from alpha.sender.org (alpha.sender.org [124.211.3.11]) by mail.sender.org (8.8.5) id 004A21; Tue, Mar 18 1997 14:36:17 -0800 (PST)
------------------------------------------------------------------------------

QUIT command, the receiving machine must send an OK reply to the sending machine--at this point--the receiving machine do not close the transmission yet--until it receives and reply to the QUIT command from the sender machine. The sender machine will also not close the transmission until it sends the QUIT command and receives a reply.

If the connection is closed prematurely, a 504 command not implemented failure reply to the sending machine and the receiving machine will act as if a RSET command had been received, cancel pending transaction due to temporary error. RSET command, specify that; current mail transaction is to be aborted and the receiver machine must send an OK reply.

RSET command aborts current mail transaction and causes both ends to reset and any stored information about sender, recipients or mail data is discarded.

A mail transaction may be aborted by the RSET command.

 

QUIT command is the last session and it cannot be used at any other time during a session.

If the transaction beginning command argument is not acceptable a 501 failure reply must be returned.

If the commands in a transaction are out of order a 503 failure reply must be returned.

 

.

 


 

SMTP has a few more commands:

SEND command SOML command SAML command
begin a mail transaction, once started a mail transaction consists of HELO, MAIL FROM and one or more RCPT commands, follows by DATA command. They (SEND SOML SAML) replace the MAIL command and allow mails to be delivered directly to the recipient mailbox or user terminal.

Help command ask the receiver machine to send help information to the sender HELP request command.

RSET command that aborts current mail transaction and causes both ends to reset and any stored information about sender, recipients or mail data is discarded.

VRFY command lets the client ask the sender to verify a recipients address, identifies a user, name, specified mailbox and returned a reply, without sending mail to the recipient.

NOOP command force the server to respond with an OK reply code 200 - NOOP command does nothing else.

EXPN expands a mailing list, asks the receiver to confirm that the argument identifies a mailing list, and if yes, return the membership of that list with full name of the users and specified mailboxes.

TURN command lets the client and server switch roles,
to send mail in the reverse direction without having to create a new one TCP connection. The receiver
must send an OK reply and then take on the role of the sender-SMTP or send a refusal 502 reply and retain the role of the receiver-SMTP.

HELP, NOOP, EXPN, and VRFY commands can be used at any time during a session between SMTP mail machine.
 

SMTP is fully defined in RFC 821
rfc2821 for the basic specification of SMTP
It is worth reading to sheds light on the mysteries and intricacies of email processing.

<><><><><><><><>

 

 

 

 

 

 

 


 

Command - a request for mail service action sent by the sender SMTP to the receiver SMTP

 

 

 

 

 

 

 

 


Art of eMail CRM | eMail Bolts&Nuts
Home | Contact UsPrivacy Policy | Guest Book | Useful Sites
Support | Purchase | Product Info | Quick Tour | eMail CRM Freeware
Line with surfer

©Copyright June 2002  Permission to re-print, please click here

 

Keywords: Email strategy ezine email strategies Emails broadcast emails broadcasting eMails ecrm emailing eCRM E-mail Ecrm e-mail e-crm Emails crm e-mails bulk CRM e-mailing promoting marketing e-Mailing sales Mail selling  mail e-marketing shareware Mails customise Shareware mails customised freeware Mailing customize Freeware mailing anti spam customized mass group broadcast Anti Spam Spamming abuse

Any feed-back or suggestions? Please
Drop us a note
email icon

To top of page

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