Results 1 to 8 of 8

Thread: Delete automatically unused emails, is it possible? [moved]

  1. #1
    Member
    Join Date
    Mar 2004
    Location
    italy
    Posts
    15

    Default Delete automatically unused emails, is it possible? [moved]

    I'd like to create a php script to delete unused emails for my cpanel account. Anyone help me please?

  2. #2
    Member
    Join Date
    Feb 2005
    Posts
    312

    Default

    Quote Originally Posted by technicolor
    I'd like to create a php script to delete unused emails for my cpanel account. Anyone help me please?
    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. #3
    Member
    Join Date
    Mar 2004
    Location
    italy
    Posts
    15

    Default

    Quote Originally Posted by freedman View Post
    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.
    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. #4
    Member
    Join Date
    Feb 2005
    Posts
    312

    Default

    Quote Originally Posted by technicolor View Post
    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
    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. #5
    Member
    Join Date
    Mar 2004
    Location
    italy
    Posts
    15

    Default

    Quote Originally Posted by freedman View Post
    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
    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. #6
    Member
    Join Date
    Feb 2005
    Posts
    312

    Default

    Quote Originally Posted by technicolor View Post
    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?
    /var/log/maillog is probably what you want.

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

  7. #7
    Member
    Join Date
    Mar 2004
    Location
    italy
    Posts
    15

    Default

    Quote Originally Posted by freedman View Post
    /var/log/maillog is probably what you want.

    and yes, read it every day.. grab the info you need and put it someplace.
    In this file are considered "login" pop3 login and webmail login?

    Thanks for your help

  8. #8
    Member
    Join Date
    Feb 2005
    Posts
    312

    Default

    Quote Originally Posted by technicolor View Post
    In this file are considered "login" pop3 login and webmail login?

    Thanks for your help
    as I said in my original message on this topic, webmail is likely IMAP login, so look for either IMAP or POP (or both)

Similar Threads

  1. Automatically deleting emails from server
    By _Chris_ in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 12-24-2007, 09:36 AM
  2. how to delete old backups automatically?
    By dhecker in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 02-20-2004, 10:57 AM
  3. Find user uploaded files & delete them automatically
    By jsnape in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 12-06-2002, 07:17 AM