LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mailq grepping (https://www.linuxquestions.org/questions/linux-newbie-8/mailq-grepping-807571/)

noxerpus 05-13-2010 08:00 AM

mailq grepping
 
Hi,

I want to exclude only ip addresses from an mailq.

So the result i need is to get a list of all the smtp IDs that that spesific ip has sent out.

I have only found a way to grep on the domain name the email has been sent to.

So for me a linux noob this command should be link this:

mailq | grep "Ip" and a list of smtp IDs including that ip will show.

But this dose not work:)

If i understand it correctly i can only grep on the domain name the e-mail has been sent to?

is there a way to get what i ask?

grail 05-13-2010 08:48 AM

Is mailq an executable? Maybe you could show what the output is?
If it is a file you have it in the wrong order:
Code:

grep Ip mailq

noxerpus 05-13-2010 08:57 AM

I generally use this command like this:

[blah@blah ~]$ mailq | grep mailq.com
D454790906 1754 Wed May 12 22:06:56 diadem@mailq.com
8DAC990C91 1778 Wed May 12 22:22:53 invitation@mailq.com
53E2D909CD 1663 Wed May 12 19:21:38 accreditation@mailq.com
51E7690711 1890 Wed May 12 21:52:13 rule@mailq.com
6FFDA90F07 1258 Wed May 12 23:19:26 brighten@mailq.com

Here i get the information i need but only on the domain name.

In a SMTP id i can read a e-mail header and i want to get a list og all the e-mails a certain ip-addresse has sent out.

Then i can go and do:

sudo postcat -q 53E2D909CD

and see this line: Received: from 192.192.0.1 (192.192.0.1 [192.192.0.1.])

so when for me it seems like i could do the same on the ip.

grail 05-13-2010 09:05 AM

I am a little lost, so is the problem you do not know what to grep for?

Obviously you only get domain info as that is what you searched for.
Can you not just do:
Code:

mailq | grep 53E2D909CD
To get all emails from that id?

Or have I missed what you want from mailq?

noxerpus 05-13-2010 09:14 AM

I want to grep that ip whitch is in the e-mail header of the smtp ID.

and the result i want is all SMTP IDs 192.168.0.1 has in our mailq.

the SMTP ID is an uniq id for all the e-mails going thru that server so this cannot be grepped.

grail 05-13-2010 09:28 AM

Quote:

I want to grep that ip whitch is in the e-mail header of the smtp ID.
So does mailq produce the header as well?

noxerpus 05-13-2010 09:38 AM

The header comes from the person sending the e-mail.

mailq or postmaster produces the SMTP id. proberly for tracking the e-mail thru the prosess of delivery etc.

I am new to this system so i dont know how to explain it better.


All times are GMT -5. The time now is 12:40 PM.