Results 1 to 4 of 4

Thread: Automatically delete emails after forwarding - what are my options?

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Default Automatically delete emails after forwarding - what are my options?

    Hi,

    I have been searching around for a while now to find an suitable answer to this problem and so far have not had much luck. Here it is...

    I have many email accounts on my bluehost account.

    They are all being forwarded to gmail accounts.

    The mailboxes on my bluehost account are filling up with these emails that are being copied and forwarded to gmail accounts. I don't want these mail accounts filling up and wasting space on the server.

    I am aware of the option to not set up the email accounts and just set up a forwarder. This does solve the main problem BUT, it means that emails can only be received, not sent from the addresses in question.

    So what other options are there? I'm sure setting up a cron job to clear the inbox regularly would be a great option but I have no idea how to write the command.

    Thanks for any suggestions!

    Shea

  2. #2
    Join Date
    Feb 2006
    Posts
    627

    Default

    The easiest way is to set the quota limit really low.


    But if you want a cron this is one of the things I use,

    Cron Command ...
    0 3 * * 1 /ramdisk/bin/perl /home/SITENAME/my_scripts/crons/dump.cgi


    The dump.cgi script ...

    Code:
    #!/usr/bin/perl
    
    ##############################################################################
    # siguie dumpmail                                                            #
    ##############################################################################	
    
        use Net::POP3;
    
    $server = "SITENAME.com";  # Domain name of any POP server on which you have
    $userid = "dump\@SITENAME.com"; # Account username for $server
    $password = "PASSWORD"; # and password
    
        # Constructors
    
        $pop = Net::POP3->new($server, Timeout => 60);
    
        if ($pop->login($userid, $password) > 0) {
          my $msgnums = $pop->list; 
          foreach my $msgnum (keys %$msgnums) {
            my $msg = $pop->get($msgnum);
             # print @$msg;
            $pop->delete($msgnum);
          }
        }
        $pop->quit;

    Replace the capitalized parts with what corresponds to your url, email address, and email password and your set.

    I actually use a more complicated version to sort and filter everything but the above will delete all your emails in the specified account.

    I hope that helps.

    Keep in mind you can also simply set email readers to download everything, delete what's left and if you define everything at the address to be classified as spam it will essentially do the same thing :)

  3. #3
    Join Date
    Feb 2008
    Posts
    28

    Default Gmail POP access.

    If it's easier you may also want to look at configuring Gmail to login to those accounts with POP. Gmail can import any messages it finds and as long as you don't have the option to leave a copy of the message on the server, it will delete the messages on the bluehost side. Gmail has articles in their Help section that can show you how to set up an Import from an outside POP account. This would let you just use the email account and not need the forwarder.

  4. #4
    Join Date
    Nov 2010
    Posts
    2

    Default

    Thanks for your responses guys, Cron Job and Gmail POP access are both options I will consider but will require a bit of work for me to get going.

    The mailbox quota limit definitely sounds like an easy solution, but what happens when it reaches it's limit? Does it just stop receiving mail because it's full? Or will it over write old messages with new ones? If the later is the case, this solution will definitely suffice... otherwise I will have to suss out one of the more advanced options.

    Thanks again!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •