How to send cron results in email

OS type and version Ubuntu Linux 20.04.4
Webmin version 1.994

I am trying to set up pflogsumm but I cannot seem to figure out hoe to send the result via cron. If I use perl /usr/sbin/pflogsumm -e -d yesterday /var/log/mail.log
How can I get this to email me the report without installing mailx?

you need mailx/MTA to send email.

normally you would add a line :


on top of the cron script.

otherwise (with sendmail/mailx/other) :

pflogsumm -e -d yesterday /var/log/mail.log | mail -s “Example Mail Report of $(date)” $email

1 Like

I used sendemail not sendmail and dedicated Gmail address for that and basic bash script, well easy and works with outside SMTP…

Nova days I use telegram bot to users IDs basically it’s instant and doesn’t spam your email…of course simple bash script command as usual. Just tell Cron to run that script once you need and script will do all operations for you one by one… including sending you results be it mail or or whatever you want.

I was worried about installing mailx. That doesn’t affect postfix at all? I would rather use
pflogsumm -e -d yesterday /var/log/mail.log | mail -s “Example Mail Report of $(date)” $email

Actually I will put you a bit back, sendmail is different from sendemail…easy configuration and totally independent from any system and settings using just bash and if you’re familiar with bash you can run Cron job on one which will send you instant messaging via be it telegram text message with details you need. I think if you asking between that and this, you can Google it right? Mailx is or perhaps used to be mostly pre installed on most Linux distributions you might have it even realising it’s there…just test your commands is good idea, error command that command was not found is no harm at all.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.