SOLVED Delete incoming emails everyday using a Cron

Ruzeen

Registered
Dec 11, 2016
2
0
1
Vancouver, BC
cPanel Access Level
Website Owner
Hi everyone,

I have forwarded mails to my Gmail account but I don't want any emails to be retained on the server. And I can't delete the mail account and just use the forwarder because I need the SMTP info to reply from Gmail.

Is it possible to delete all incoming emails from a particular mail account everyday, using a cron job? Does anyone know how I can achieve this?

Or is there a better way to go about this?

Much thanks!
 

Eric

Well-Known Member
Nov 25, 2007
754
13
143
Texas
cPanel Access Level
Root Administrator
Twitter
Howdy,

You've got 2 options I can think of in this insomnia:

1. Make the output of the crontab go away. Add the > /dev/null to the end of the command and it should shut its trap. An example:
Code:
* * * * *        /usr/local/sbin/mycommand.sh > /dev/null
2. Remove the mail address it's pointing to. Delete or set a dev/null account for the MAILTO= line in the crontab.

Thanks!