HOW: Find out how many emails sent to Yahoo email addresses?

mtindor

Well-Known Member
Sep 14, 2004
1,417
82
178
inside a catfish
cPanel Access Level
Root Administrator
This is really off the cuff. There are more efficient ways. But try this:

grep 'yahoo\.com ' /var/log/exim_mainlog|grep '=>'|wc

That'll tell you how many were sent over the course of your current exim_mainlog (which could be many days). If you want to see, for instance, on 6-4-2008 then do:

grep 'yahoo\.com ' /var/log/exim_mainlog|grep '=>'|grep '2008-06-04|wc

The space at the end of 'yahoo\.com ' makes sure it doesn't count emails to yahoo.com.hk and other non-US Yahoo.

Piping those results to wc (word count) via |wc will give you the number sent, at least a very good approximation.

Mike
 
  • Like
Reactions: mohit

SuperBaby

Well-Known Member
Nov 27, 2003
343
0
166
Thailand
cPanel Access Level
Website Owner
Twitter
I am getting this. What do the numbers mean?

# grep 'yahoo\.com ' /var/log/exim_mainlog|grep '=>'|wc
125 1152 16541

# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|wc <== without a white space after "yahoo.com"
127 1172 16856

On the other hand, I got only " > " for this:

# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|grep '2008-06-04|wc
>
 

mtindor

Well-Known Member
Sep 14, 2004
1,417
82
178
inside a catfish
cPanel Access Level
Root Administrator
I am getting this. What do the numbers mean?

# grep 'yahoo\.com ' /var/log/exim_mainlog|grep '=>'|wc
125 1152 16541

# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|wc <== without a white space after "yahoo.com"
127 1172 16856

On the other hand, I got only " > " for this:

# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|grep '2008-06-04|wc
>
The first number is the line count - which is going to give you the approximation you want. There are line counts, word counts and character counts and some other things.

If you just want it to display what you're looking for, pipe it to wc -l instead of just wc

wc -l will display the line count (# of lines that matched)

Mike
 

mtindor

Well-Known Member
Sep 14, 2004
1,417
82
178
inside a catfish
cPanel Access Level
Root Administrator
I am getting this. What do the numbers mean?

# grep 'yahoo\.com ' /var/log/exim_mainlog|grep '=>'|wc
125 1152 16541


# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|wc <== without a white space after "yahoo.com"
127 1172 16856
The difference between the two indicates [most likely] that you have 2 emails that were sent to @yahoo.com.??? addresses - like yahoo.com.hk or something like that. When you put the whitespace after it, it makes sure to only give you the values for emails sent specifically to @yahoo.com addresses.

On the other hand, I got only " > " for this:

# grep 'yahoo\.com' /var/log/exim_mainlog|grep '=>'|grep '2008-06-04|wc
>
That's because you don't have an ending single-quote after 2008-06-04 - If you add the ending ' then it'll work.

Mike
 

verdon

Well-Known Member
Nov 1, 2003
919
12
168
Northern Ontario, Canada
cPanel Access Level
Root Administrator
I use configserver's mailscanner package. Part of that is mailwatch, which is perfect for monitoring this kind of stuff. I don't know much about using mailwatch as a stand-alone, but it may be of interest to you.

mailwatch.sourceforge.net