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 automatically unused emails, is it possible? [moved]

Discussion in 'Database Discussions' started by technicolor, Sep 6, 2006.

  1. technicolor

    technicolor Member

    Joined:
    Mar 11, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    italy
    I'd like to create a php script to delete unused emails for my cpanel account. Anyone help me please?
     
  2. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    well. I'm not sure what you mean... how are you wishing to determine what "unused" is

    email users are stored in:
    /home/USERDIR/etc/DOMAIN/{passwd,shadow}
    and there's a folder in /home/USERDIR/etc/DOMAIN/ for some email names

    if you're wanting to delete other unused emails, you'll have to be more specific about what you're trying to do in order for anyone to help you.
     
  3. technicolor

    technicolor Member

    Joined:
    Mar 11, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    italy
    Hi, i propose this question again. I need a php script to delete automatically and dayly unused email account. Unused means that test@example.com was not read from POP3 and webmail from 100 days. Thanks for help and sorry for english
     
  4. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    for this solution you would have to sift through the mail logs. You would have to track (daily) which accounts received valid logins from pop or imap (webmail likely uses imap).
    then you could know who to delete.. but unless you keep your mail logs for 100 days, you wont be able to do this without storing this historical infomation somewhere.

    the maillog for dovecot--I'm not sure if mailman is exactly the same--entries look like this:

    MON DAY TIME HOST dovecto: POP3(email_address): ....

    so I'd grab those, and store them with their dates.. any that dont have entries within 100 days can be deleted in your case
     
  5. technicolor

    technicolor Member

    Joined:
    Mar 11, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    italy
    Where can i read mail logs login? Every day i can read this file and update a database where i can update last login for every email account. Do you think is this a solution for my problem?
     
  6. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    /var/log/maillog is probably what you want.

    and yes, read it every day.. grab the info you need and put it someplace.
     
  7. technicolor

    technicolor Member

    Joined:
    Mar 11, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    italy
    In this file are considered "login" pop3 login and webmail login?

    Thanks for your help
     
  8. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    as I said in my original message on this topic, webmail is likely IMAP login, so look for either IMAP or POP (or both)
     
Loading...

Share This Page