The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Delete original after forwarding

Discussion in 'E-mail Discussions' started by Manos Krokos, Apr 15, 2016.

  1. Manos Krokos

    Manos Krokos Member

    Joined:
    Apr 15, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Athens
    cPanel Access Level:
    Root Administrator
    I have read several posts about this. The first solution, that is to delete the actual email account and keep only the forwarder is not an option.
    Creating filters for each account is also not an option since we are talking about 700+ accounts out of a total 1200.
    So that leaves me with the solution of a cron job that would delete inbox content for these 700+ accounts, correct? Any other suggestions are welcome.
    Where should I be looking? What should be removed? Remember that I need to delete the inboxes of certain accounts, not everyone's.
    So scripting is crucial, I guess. Has anyone seen anything that works like that?

    Best regards,
    Manos K
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will likely need to manually compile a list of all of the email accounts that you to remove emails from when developing your custom script, unless there is some kind of matching pattern you can use to group the accounts (e.g. accounts starting with a specific letter). Once you have a list, you could develop a script similar to what's utilized on this thread:

    Having issues getting cron job to work

    Thank you.
     
  3. Manos Krokos

    Manos Krokos Member

    Joined:
    Apr 15, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Athens
    cPanel Access Level:
    Root Administrator
    thanks for that!

    In the meantime, I created a txt file with all accounts that are forwarded and then I compiled a script that deletes the inbox (cur) for these accounts. The script is run once a week.
     
  4. Ameya Barwe

    Ameya Barwe Well-Known Member

    Joined:
    Jan 1, 2016
    Messages:
    49
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Nashik
    cPanel Access Level:
    Root Administrator
    Is it possible to share the script here?
     
  5. Manos Krokos

    Manos Krokos Member

    Joined:
    Apr 15, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Athens
    cPanel Access Level:
    Root Administrator
    Sure, here it is
    The format for the txt file is:
    username;domain;user;
    where username is the master account username and user is the email account username.
    You can run this via cron as often as you wish.
     

    Attached Files:

Loading...

Share This Page