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.

Auto-delete pop email to integrate with Gmail

Discussion in 'E-mail Discussions' started by beyondbeyond, Oct 20, 2015.

  1. beyondbeyond

    beyondbeyond Registered

    Joined:
    Jul 18, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I do not like to manage pop accounts on our server. I encourage all our clients to use email forwards to Gmail, or Google Apps. Here is another solution that almost works:

    1. Set up a forward to a gmail account (this is easy to do in cpanel)

    2. Set up a cpanel pop account so that gmail will allow client to send mail from his domain (this is easy Change the "From" address when replying or forwarding - Gmail Help)


    3. Create some way for cpanel to auto-delete email in the inbox to avoid the email box from growing and growing. I would like to just keep the last 100mgs, or keep nothing once an email is forwarded?

    I need help from some tech genius with the third step.

    Thank you
     
  2. beyondbeyond

    beyondbeyond Registered

    Joined:
    Jul 18, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I just thought of this. Not sure if it will work.

    If Google just wants an authenticated pop account to send, perhaps we can just use user@domain.com (where 'user' is the cpanel username and the password is the cpanel user password).

    I tried to add this but Google rejected it with this error:

    Authentication failed. Please check your username/password.
    [Server response: 535 Incorrect authentication data code(535) ]

    Any other ideas?
     
  3. 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 can create the email account and then setup an account or user-level filter that discards email after it's forwarded:

    User Level Filtering - Documentation - cPanel Documentation

    Thank you.
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    I am not sure how to do this with filtering to discard after it is forwarded but I use this in a cron.
    Code:
    # delete the emails after 5 days
    for dir in cur new
    do
            find "/home/HOMEDIR/mail/DOMAINNAME/EMAIL/$dir/" -type f -mtime +5 -delete
    done
    [/code/
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    cPanelMichael, I put that comment there saying I personally did not see how to make a filter that would delete the email after it is forwarded. If you use a forwarder you do not use filters. Thus what would you write in a filter to know that it was indeed forwarded and then deleted. I personally did not need to know this information the original poster did. I was letting him know how I would handle this. I think if you wanted to post something for his post then you could reply to his #3 Create some way for cpanel to auto-delete email in the inbox to avoid the email box from growing and growing. I would like to just keep the last 100mgs, or keep nothing once an email is forwarded? but thanks for the reply. It would be nice to know what to put into a filter to answer what he wants. I've read the documentation and still would not have a better answer for beyondbeyond.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    thanks
     
  9. Rui Cabanita

    Rui Cabanita Registered

    Joined:
    Nov 3, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Santarem, Portugal
    cPanel Access Level:
    Website Owner

    I think I have a solution.

    I tried all sorts of account-level filters only to run into all sorts of BCC handling problems. Instead, I made the Gmail destination account check the originally forwarded account via POP3 (Gmail settings > Accounts > Check mail from other accounts).

    It may seem silly to forward the messages to begin with and then have gmail go back again but it solved all the issues. Because it it forwarded from the server it arrives at gmail's inbox much faster. Otherwise you have to wait for Gmail next POP3 cycle, which you can't control, and can take up to an hour I believe. Gmail's POP3 checking will then delete the messages accomulating on the server. At most you get about an hour worth of emails pilled up at the server.

    Not the most elegant solution in terms of traffic but I couldnt find better.

    Regards,
     
Loading...

Share This Page