Deleting Mails with Cron ???
Hi,
I want to delete all mails once a day but i couldn't do it. I used this command:
rm /home/{username}/mail/domain.net/test/cur/*">{domain.com}/{mailusername}/cur/*
I deleted only inbox mails. But i want to delete inbox and sent mails.
help me !!!
-
Ofcourse you can do this using cron. You can put below two commands in one file and set cron for that file. Suppose create /root/maildelete.txt. Put below commands in that file : rm -rf /home/{username}/mail/{domain.com}/{mailusername}/cur/* rm -rf /home/{username}/mail/{domain.com}/{mailusername}/sent/* and then set cron for /root/maildelete.txt 0 -
Ofcourse you can do this using cron. You can put below two commands in one file and set cron for that file. Suppose create /root/maildelete.txt. Put below commands in that file : rm -rf /home/{username}/mail/{domain.com}/{mailusername}/cur/* rm -rf /home/{username}/mail/{domain.com}/{mailusername}/sent/* and then set cron for /root/maildelete.txt
thanks for your help the command works for inbox, but not work for sent folder. there is not a "sent" folder. and i don't know where sent mails are storing... I add the my mail screenshot... If you know, how can i empty sent folder? One more, what is the meaning of "-rf" command?0 -
Hello, I forgot to mention the .(dot) for Sent folder. Use below syntax: rm -rf /home/{username}/mail/{domain.com}/{mailusername}/.sent/* Further, r means recursive and f means forcefully. 0 -
thanks a lot for your help. and one more thing i found rm -rf /home/{username}/mail/{domain.com}/{mailusername}/.Sent/cur/* the bold part is important. 0 -
Ok, Thanks for the update. We are glad that your issue gets fixed :) 0 -
Hello, I am happy to see the solution provided was helpful. Thank you for updating us with the outcome. 0 -
Hi, I need one more help... All personels are using mail system, and all mails are forwarding personals' other mail address: for example, all mails are forwarding from main.address@domain.com to personel@gmail.com and it is working best. Problem: If you don't open webmail interface, cron job doesn't delete inbox mails. If you access webmail interface (you don't need to read mails), cron job delete inbox mails. WHY??? How can i delete inbox mails without access webmail interface because of forwarding all mails??? 0 -
Hi :), The cronjob should delete the emails in "cur" directory without accessing the webmail. Please check if you have set the cron correctly. 0 -
Hi :), The cronjob should delete the emails in "cur" directory without accessing the webmail. Please check if you have set the cron correctly.
hi danrussell, my cron job code is: rm -rf /home/username/mail/domain.net/mail_user_name/cur/* is there any mistake?0 -
I think i found the right code: find /home/{username}/mail/{domain.com}/{mail-user-name}/ -type d \( -name cur -o -name new \) -exec find {} -type f -delete \; example: username : sitenm domain: sitenm.com mail-user-name : info (info@sitenm.com) find /home/sitenm/mail/sitenm.com/info/ -type d \( -name cur -o -name new \) -exec find {} -type f -delete \; 0 -
I think i found the right code: find /home/{username}/mail/{domain.com}/{mail-user-name}/ -type d \( -name cur -o -name new \) -exec find {} -type f -delete \; example: username : sitenm domain: sitenm.com mail-user-name : info (info@sitenm.com[/EMAIL]) find /home/sitenm/mail/sitenm.com/info/ -type d \( -name cur -o -name new \) -exec find {} -type f -delete \;
I am testing this code, i hope it works well... I will write the stuation...0 -
Feel free to update us with the outcome after testing out your cron job. Thank you. 0 -
It is working best, no problem... I am using that. thanks your helps. 0 -
I am happy to see the issue is now resolved. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
14 comments