How to get fetchmail.pl to work on CentOS

grigansky
2011-09-07
2013-01-23
  • grigansky

    grigansky - 2011-09-07

    Hi, I reread documentation, posts in google related with “get fetchmail to work”. After several days I have completed own instruction for CentOS:

    1.

    [b]yum[/b] install fetchmail
    [b]rpm[/b] -qa | grep fetchmail
    fetchmail-6.3.6-1.1.el5_3.1
    

    2.install next perl modules:
    cpan install:
    DBI
    MIME::Base64
    File::Temp
    Sys::Syslog
    File::Temp
    LockFile::Simple

    3.create a directory, lockfile for fetchmail:
    mkdir /var/run/fetchmail
    touch /var/run/fetchmail/fetchmail-all.lock
    chown vmail:vmail –R /var/run/fetchmail
    (vmail – user from dovecot.conf-socket listen master-user and owner of /var/vmail (“/var/vmail”  is from conf postfix(main.cf) - virtual_mailbox_base = /var/vmail) )

    4.put your settings to /etc/mail/postfixadmin/fetchmail.conf

    cat fetchmail.conf
    # database backend
    $db_type = 'mysql';
    # host name
    $db_host="localhost";
    # database name
    $db_name="postfix";
    # database username
    $db_username="postfix";
    # database password
    $db_password="YOUR PASSWORD";
    

    5.chown vmail:vmail  /etc/mail/postfixadmin/fetchmail.conf

    6. add in crontab:

    */10 * * * * /usr/bin/sudo -H -u vmail perl /opt/postfixadmin/ADDITIONS/fetchmail.pl
    

    7. add vmail user to sudouser

    8.commit

    #Defaults    requiretty
    

    in /etc/sudoers (if you don’t do it, you will receive in log file: sudo: sorry, you must have a tty to run sudo)

    After all this fetchmail.pl should start work, but I have next error in log:

    Sep  7 12:40:02 server fetchmail-all[21420]: fetch user@real-domain.com for user@local-domain.com
    Sep  7 12:40:02 server fetchmail[21427]: Unknown login or authentication error on user@real-domain.com@mail.real-domain.com
    Sep  7 12:40:02 server fetchmail[21427]: socket error while fetching from user@real-domain.com@mail.real-domain.com
    Sep  7 12:40:02 server fetchmail[21427]: Query status=2 (SOCKET)
    

    Can you help me?

     
  • grigansky

    grigansky - 2011-09-07

    I changed in postfixadmin remote user to user (was user@real-domain.com) and remote server to real-domain.com (was_ mail.real-domain.com_), but again have error in log:

    Sep  7 13:30:01 server fetchmail-all[22705]: fetch user for user@local-domain.com
    Sep  7 13:30:22 server fetchmail[22707]: connection to real-domain.com:pop3 ["real-ip of real-domain.com"/110] failed: Connection timed out.
    Sep  7 13:30:22 server fetchmail[22707]: POP3 connection to real-domain.com failed: Connection timed out
    Sep  7 13:30:22 server fetchmail[22707]: Query status=2 (SOCKET)
    
     
  • grigansky

    grigansky - 2011-09-07

    I have new errors after previous changes

    Sep  7 14:00:01 server fetchmail-all[23509]: fetch user for user@local-domain.com
    Sep  7 14:00:02 server fetchmail[23511]: Unknown login or authentication error on user@mail.reall-domain.com
    Sep  7 14:00:02 server fetchmail[23511]: socket error while fetching from user@mail.reall-domain.com
    Sep  7 14:00:02 server fetchmail[23511]: Query status=2 (SOCKET)
    

    I think error is in, when script concat remote user name and remote server name -> user@mail.real-domain.com, in this case script should trims "mail" part from remote server name and after this concat remote user name and remote server name -> user@real-domain.com, at result remote user name will be - user@real-domain.comremote server name will be - mail.real-domain.com

     
  • GingerDog

    GingerDog - 2011-09-07

    Random thoughts - I know little about fetchmail.pl stuff, but :

    1. Check the configuration file the script creates (presumably /tmp/fetchmail-all-XXXX) (where X will be a random character).

    2. the src_user field should be the pop3 username (which is often a full emailaddress). Seeing user@whatever.xx@something.yy is just how it is being logged).

    3. I'd be more interested why you were seeing the pop3 server connection timeout/fail to connect -

    Sep  7 13:30:22 server fetchmail: connection to real-domain.com:pop3  failed: Connection timed out.

    Could the remote server have blocked you because you failed to login too many times? Do you need to connect with pop3+ssl instead?

    David.

     
  • grigansky

    grigansky - 2011-09-08

    Thanks,David, for answer. Realy, I should was disable of using ssl/tls. ssl option wasn't checked in web form of my mail account(in postfixadmin), I am thinking, that this option doesn't work. I solved the problem by adding manually option in postfix.db

    field "extra_options" -> sslproto ssl23
    

    . It would be nice to add the ability to add any extra options on web form of mail account in postfixadmin.

     

Log in to post a comment.