HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   Mailq values into a mysql database... (http://www.howtoforge.com/forums/showthread.php?t=41844)

voltron81 15th December 2009 12:56

Mailq values into a mysql database...
 
Hi to everybody.
I'm trying to create from mailq a database with the details of all the emails queued.

I saw that with the command:
Code:

mailq | grep user@domain.com | awk '{print($1);}'
I'll have the value for the field 1, 2 for 2, etc...
The problem is coming for the "sender/recipient", that is actually on 2 lines:
Code:

9BBF287C66    2827 Tue Dec 15 09:47:31  user@domain.com
                                                          (deferred transport)
                                        user@gmail.com

so the result of the command
Code:

mailq | grep user@domain.com | awk '{print($7);}'
will be just the sender...

Any idea how can obtain the value of the receiver?
And an idea how to put this values into a mysql database?

Thanks
Michele

topdog 16th December 2009 18:11

There is a cpan module u could use. http://search.cpan.org/~rjbs/Postfix...Parse/Mailq.pm

voltron81 18th December 2009 13:29

Thanks topdog,
I'll have a look on it...


All times are GMT +2. The time now is 23:43.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.