Linux Shell Script to extract data of email sent and mail back to admin

Solution 1:

Whenever something needs counting, wc is your friend:

grep 'to=<[email protected]>' /var/log/maillog | wc -l