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.

DL e-mail from another POP3 into cPanel

Discussion in 'E-mail Discussions' started by kemis, Feb 7, 2006.

  1. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    Our IT department at work has an extremely lousy implementation of SpamAssassin.

    I want to setup my VPS to somehow check/download all e-mail from my work's POP3 account so that my cPanel server can run its own filters/spam checking on those e-mails.

    I would then check my POP3 e-mail from my cPanel server instead of from work.

    Any ideas?

    Thanks,
    Matt
     
  2. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    I take it you cannot simply forward emails from work to your preferred address (using a forward, not by forwarding individual messages)...
     
  3. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    Woo hoo!

    Nope, our IT sucks. They refuse to forward, so I'm forced to work around that fact.

    As it turns out, my VPS hosting company mentioned a program called "fetchmail" to me. Evidently, this is a very popular program that does exactly what I'm needing. (Incidently, fetchmail is used in Horde to get mail from a different account, but it can't be set to run automatically as far as I can tell.)

    It took me about 3 hours to muck around with the user guide and find other people's sample files, but here's what I did:

    1. Logged into my VPS as root.
    2. Eventually created a "~/.fetchmailrc" file structurally identical to this:

    Code:
    set daemon 120  #run as daemon & poll every 2 minutes
    set logfile = "/var/log/fetchmail.log"  #log is only output when no terminal
    set no bouncemail  #not sure
    set no spambounce  #not sure
    set invisible  #makes the e-mail still look like it's to/from the original?
    
    poll mail.mywork.com  #pop3 mail server
            with protocol POP3 no dns  #access via POP3, not sure about the dns
    	#POP3 user/pass, send to diff e-mail...
            username user1 password u1pass is user1@myowndomain.com
    	username user2 password u2pass is user2@myowndomain.com
      	username user3 password u3pass is user3@myowndomain.com
    	username user4 password u4pass is user4@myowndomain.com
    
    flush  #remove downloaded messages from original server
    fetchall  #get all even, if already seen
    fetchlimit 0  #no fetch limit
    fetchsizelimit 0  #no size limitations
    ;
    3. Then, I just ran fetchmail by typing its name at the command line!

    I still need to figure out how to put it in my startup scripts so it's sure to run when my server is rebooted. This is a basic Linux task I've never mastered. Can someone help me with it?

    -- Matt
     
    #3 kemis, Feb 9, 2006
    Last edited: Feb 9, 2006
  4. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    DAEMON MODE

    http://www.catb.org/~esr/fetchmail/fetchmail-man.html#12

    Now, just trying to see if can be setup so each user can do it. Or - does anyone know if can be setup to check for an include file, if exists and run it? That way, only one file and no admin time needed to update.
     
  5. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    I know about the daemon mode. That's how I'm running it now. I just don't know how to make it so that the daemon starts automatically when the server does. I know I need to put a startup script in the init.d or something, but not sure what to name the script, which runlevel, permissions, exact statements, etc.

    Thanks!
    Matt
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Simplest way is to put the required statements into your own script and then call that script from within /etc/rc.d/rc.local with:

    /path-to/my/script.sh
     
  7. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    It works! Thanks so much for the tip on the rc.local file!

    -- Matt
     
Loading...

Share This Page