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: 18: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: 17: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: 17: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: 17: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: 17: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: 17: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: 17: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 mypasswordUse 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 6072 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: 17:59 | category: /mail | Comments ()
|
|
|
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.
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... |
|
|
| |
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)
Envelope
(2)
headers are used by the
user agent and each header field contains a name, followed by a colon, followed by the field
value. (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
Operational Sequent of: 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... A 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... A 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.
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 |
|
|
|
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
QUIT
|
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. 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. 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 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,
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 <><><><><><><><>
|
|
|
|
©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 |
|
|
Rustybear Blog
