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.

How to Discard after forwarding email?

Discussion in 'E-mail Discussions' started by jbastan, Mar 1, 2008.

  1. jbastan

    jbastan Member

    Joined:
    Nov 16, 2006
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    We have about 60 email accounts, nearly 15 of them being forwarded to various other domains (forwarding works fine as expected). This leaves copies on the server, so I've been having to log in to each accounts to delete and purge them one by one, every month and it's getting annoying.

    So is there a safe way we can automatically discard them from the server after they are forwarded, instead of keeping a copy?

    I know I can increasing quota and do this less often, but I'd prefer a more automated option.

    Thanks in advance.
     
    #1 jbastan, Mar 1, 2008
    Last edited: Mar 1, 2008
  2. johnmigen

    johnmigen Active Member

    Joined:
    Jan 19, 2008
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    If you only need to forward emails, you probably already have added the forwarder.

    Your forwarder will work even if you do not have an pop account, that is to say, you can safely delete the pop account in your mail account section. So long the forwarder is there, all emails will continue to forward without leaving a copy in your mailbox.
     
  3. jbastan

    jbastan Member

    Joined:
    Nov 16, 2006
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Good point, but some of these 15 accounts are actually being used to send as themselves. So they need to exist.

    I guess we could also setup the mail client to do this correctly (reply as: original account name).
     
  4. johnmigen

    johnmigen Active Member

    Joined:
    Jan 19, 2008
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    You may also want to consider running a cron job to empty the email folder of the 15 accounts so there you don't need to change what you already been doing.

    rm -f /home/username/mail/domain.com/user/new/*
     
  5. hergy80

    hergy80 Well-Known Member

    Joined:
    Sep 4, 2004
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    Instead of setting up a forward, you could use a mail filter that when the mail coming in matches the header To address, it will deliver the mail to a different e-mail address, therefore not putting the message into the original mailbox.
     
  6. jbastan

    jbastan Member

    Joined:
    Nov 16, 2006
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hergy and John, both great solutions. I will split the accounts and try them both, and eventually pick one.


    [This is a week or two later]
    I've decided that John's idea to set up a cron tool is better, but adding my own twist. I'll be making a perl script that will access all these accounts and remove the old emails if they are older than XX days for "just-in-case" situations.
     
    #6 jbastan, Mar 8, 2008
    Last edited: Mar 27, 2008
  7. toddring

    toddring Registered

    Joined:
    Oct 20, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    How do I delete the mail for the main account

    Your cron job is great but how do I do this for the main account. Is it the account name?

    Please help.

    Thanks Todd
     
  8. johnmigen

    johnmigen Active Member

    Joined:
    Jan 19, 2008
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    For your main account

    rm -f /home/username/mail/new/*
     
  9. SageBrian

    SageBrian Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    415
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    NY/CT (US)
    cPanel Access Level:
    Root Administrator
    Would not the proper way to do this is to just use forwards?

    Forwarder goes to their ISP/other mailbox.
    Then, setup their mail client at their ISP/other to send as the forward? Unless, of course, we are dealing with AOLer's.

    example:
    sales@companycom ----> happy456@gmail
    info@companycom ----> happy456@gmail

    On gmail, setup aliases so they can send out with an address of 'sales@companycom' or 'info@companycom'


    One thing to keep in mind with the forwards to another ISP, especially AOL, is that the other ISP may view you as a spammer or spam relay.

    Brian
     
  10. taotoon

    taotoon Well-Known Member

    Joined:
    Nov 14, 2004
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    This is a trick. No need to setup forward mail account.

    Setup account filtering in cpanel page:

    Any header contain your@yourdomain.com redirect to email your@gmail.com

    Don't forget to add your@yourdomain.com in Gmail contact list to avoid spam or blacklist.


    [​IMG]
     
    #10 taotoon, Apr 13, 2008
    Last edited: Apr 21, 2008
  11. bstpierre

    bstpierre Registered

    Joined:
    Apr 21, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    This is exactly what I was looking for, thanks. I saw the FAQ about forwarding email to gmail (exactly what I want to do for one of four accounts at my domain) but the FAQ lacked (enough) detail (for me) in the answer.

    Thanks again!
     
  12. patchwork

    patchwork Well-Known Member

    Joined:
    Nov 2, 2001
    Messages:
    92
    Likes Received:
    0
    Trophy Points:
    16
    Is there any chance you could share the script, its exactly what I'm trying to do.

    Thanks
    Pete
     
  13. mfwills

    mfwills Member

    Joined:
    Oct 9, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Why is "Discard" not recommended?

    And why can't cPanel do something as simple as email aliases, instead of forwarders and deleting the POP and all this other stuff?

    Matt
     
  14. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Can you elaborate? I ask because cPanel's Email Forwarders offers the functionality of what is known as "Email Aliases" in other hosting environments.

    Note, a mail account for a specific email address does not need to exist before you set up a forwarder for that specific email address.
     
  15. mfwills

    mfwills Member

    Joined:
    Oct 9, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Other messages indicated that I had to set up a POP account, then a forwarder, then delete the POP account, but not if I want to be able to use the forwarded address to send mail.

    Matt
     
  16. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,279
    Likes Received:
    36
    Trophy Points:
    48
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    SageBrian: Certainly just using a forward would accomplish this. However, the problem is that if you only have a forwarder and you do not have a POP3 account by the same name, you get no spam filtering. So, let's say that mailbox gets 100 messages today and 99% of those are spam, if you only use a forward and forward those emails onward, you've just forwarded 99 spam emails to another place. And if that place is Hotmail, or Yahoo, or AOL, or Comcast, or one of many other places, you'll find that they refuse to accept any of that mail either temporarily or permanently in the future because it was found by them to be spammy.

    So in order to do it gracefully and in a more net-friendly way, you'd have to create a POP3 account, enable spamassassin for that domain, set it to autodelete spam, and then set a forward on it. Then any incoming mail found to be spam will be deleted. Of course, a the origianl message ends up in the POP3 mailbox and will need to be deleted, but then only the emails that spamassassin didn't tag as spam will be forwarded, making it much less likely that the mail system hosting the email address that mail is being forwarded to won't reject/blacklist those mails down the road.

    Mike

     
  17. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,279
    Likes Received:
    36
    Trophy Points:
    48
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    Taotoon,

    Can you tell me if spam emails get forwarded or if they do not when you do it your way?

    If you have spamassassin enabled on that domain, will spam-tagged emails be autodeleted if you have Autodelete Spam enabled, before forwarding the mails?

    mike



     
  18. mfwills

    mfwills Member

    Joined:
    Oct 9, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Does spam filtering work if the mailbox to which you are forwarding is in the same domain/server?

    All I am interested in is what other systems call "aliases." I don't want any mail kept where it is really just a duplicate of what has been forwarded.

    Matt
     
  19. agentblack

    agentblack Well-Known Member

    Joined:
    Mar 28, 2008
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indiana
    i tried just using the forwarder for our fire department emails however that method doesnt work. the server accepts the mail, but it doesnt send it anywhere.

    originally what i had set up was a pop account, then went to forwarders and added the forward, but as the server started to fill up, i went thru and tried deleting just the pop account and leaving the forwarder and it doesnt work.

    what i want to happen:

    email comes in, email is then forwarded on to the correct location. our department is too small to have people logging into the server to check pop, and it is easier for us to forward the mail out to everyone. once the message is forwarded, i want it deleted so it doesnt take up space.

    thoughts on how to make this happen?
     
  20. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    The described scenario of only having an e-mail forwarder (e-mail alias) should work; if the e-mail account is removed and you have ensured the e-mail forwarder exists but still does not work, please submit a ticket as it may require more in-depth inspection of the issue.
     
Loading...

Share This Page