Is there any documentation on the binary format of the mail files under /var/spool/postfix/ ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Is there any documentation on the binary format of the mail files under /var/spool/postfix/ ?

Geert Stappers
On Tue, May 30, 2017 at 07:42:24PM +1200, Peter wrote:

> On 30/05/17 19:40, Geert Stappers wrote:
> > On Mon, May 29, 2017 at 05:02:36PM +1200, Peter wrote:
> >> On 29/05/17 16:57, Peter wrote:
> >>> find "$(postconf -h queue_directory)/deferred/)" -type f -exec postcat
> >>> -e {} + | your_program | postsuper -d -
> >>
> >> Oops, typo there, should be:
> >>
> >> find "$(postconf -h queue_directory)/deferred/" -type f -exec postcat -e
> >> {} + | your_program | postsuper -d -
> >>
> >
> } I don't see the difference between them. What is it?
>
> The first one has a stray ")".

Ah, got it. thanks.


> > Is it the +  that should be removed??
>
> The "+" is in both.

Yes, the + is in both.
It looked strange.
Learned that it belongs the find exec {}


Groeten
Geert Stappers
--
Leven en laten leven
Reply | Threaded
Open this post in threaded view
|

RE: Is there any documentation on the binary format of the mail files under /var/spool/postfix/ ?

angelo
In reply to this post by Hubro
Hi, I see you have gotten plenty of good responses, but here is how I deal with it.
Once I know what I am looking for.... from the command line I do this, and it is pretty fast for 1 to 2 thousand emails at a time.

These are some recent examples I used to clean things up, that were sitting there for days already.

HOLD queue:
postqueue -p|grep match.com|awk '{print $1}'|sed -r 's/!//'|while read id; do postsuper -d $id;done

Deferred queue:
postqueue -p|grep MAILER|awk '{print $1}'|while read id; do  postsuper -d $id;done



-Angelo Fazzina
Operating Systems Programmer / Analyst
University of Connecticut,  UITS, SSG, Server Systems
860-486-9075

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Hubro
Sent: Sunday, May 28, 2017 7:07 PM
To: [hidden email]
Subject: Re: Is there any documentation on the binary format of the mail files under /var/spool/postfix/ ?

I have already made similar scripts, but the issue is that it runs "postcat"
and "postsuper" once for every queue ID, so it becomes absolutely unusable
when needing to delete tens- or hundreds of thousands of emails.

So far I have been lucky in that most of spam scripts send mail with only a
few different sender email addresses, so I've been able to grep the output
of "postqueue -p" 4-5 times, used Vim to create a long list of queue IDs and
fed it to "postsuper -d -" through the standard input.

However, I'm never sure I've caught all the spam mails sent from the
specific IP, and some day I could have to clean up the spam of a script that
generates random sender email addresses. That day I'm going to need a fast
script that can filter queue IDs by sender IP.

I really, really wish "postcat -e" had a "-" option, like postsuper, that
allowed me to stream queue IDs in through stdin...



--
View this message in context: http://postfix.1071664.n5.nabble.com/Is-there-any-documentation-on-the-binary-format-of-the-mail-files-under-var-spool-postfix-tp90656p90662.html
Sent from the Postfix Users mailing list archive at Nabble.com.
12