Koozali.org: home of the SME Server
Contribs.org Forums => General Discussion => Topic started by: SchulzStefan on October 30, 2013, 10:18:40 AM
-
Is there a way (or a contrib) to grep all email-adresses to the receipients from a single user? Any hint would be nice.
Thank's in advance,
stefan
-
please explain your problem and not your solution, thank you :-)
-
As I described - I don't know how to grep out of the logs all email from a single user to his/her receipients. I simple do not know which log and what command could do it. I'd like to have the data in a file to check all email-adresses. Sorry for my bad english.
-
You could start with this:
grep logters.*\(queue /var/log/qpsmtpd/current
and see what you get.
This will pull all 'logterse' (summary) entries from the qpsmtpd log that resulted in a successful delivery (vs a deny message).
The email sender and recipient address are in the second half of the results.
You might also try downloading qploggrep (http://wiki.contribs.org/Email_Statistics#qploggrep), then use
qploggrep <sender-email-address>
or
qploggrep <sender-email-address> |awk '{print $6}' |sort -u
If the user uses authenticated smtp relay, you'll need to figure out how to include /var/log/sqpsmtp/* in your searches...
However, this won't help you if the user has an email client or device that is relaying outbound email through google or another smtp server claiming to come 'from' his/her work email address -- hence the earlier question about 'what is the actual problem'...
Basically, the qpsmtpd logs will probably show you the same stuff you'd get from going to the user's 'Sent Items' folder and greping for 'To: ':
cd /home/e-smith/files/users/<username>/Maildir/.Sent\ Messages
grep ^To:\ * |awk '{print $2 $3 $4 $5 $6 $7 $8 $9 $10}' |sort -u
(repeat for ".Sent Items" and ".sent-mail"; include ".Trash", ".Deleted Items" and ".Deleted Messages" if you think s/he has been deleting things)
-
Thank's a lot. That's exactly what I was looking for.
stefan