Install and set up intranet-mail-import

1) Get package from CVS
/web/projop/packages/cvs checkout intranet-mail-import

2) Install package using the ]po[ Package Manager

3) Install fetchmail
yum install fetchmail
4) Set  fetchmailrc
touch /web/projop/.fetchmailrc
chmod 600 /web/projop/.fetchmailrc
as follows (~/.fetchmailrc)
set logfile /web/projop/fetchmail.log
set invisible
set no bouncemail

poll [MAIL-SERVER] protocol imap username [USERNAME] password [PASSWORD]
fetchall
nokeep

mda "/usr/bin/procmail"

6) Setup crontab Add the following line to user 'projop's crontab
*/5 * * * * fetchmail --nokeep -s -K &> /dev/null


7) Install  procmail

yum install procmail

8)  Configure procmail -> ~/.procmailrc

MAILDIR=/var/spool/mail
DEFAULT=$MAILDIR/projop/
LOGFILE=/web/projop/Maildir/procmail
VERBOSE=on
:0
/web/projop/Maildir/

9) Set the parameters of package intranet-mail-import accordingly.
    http://[YOUR_SERVER]/intranet/admin/parameters/
  

Testing mail import

a) Send an email to the address as configured in /web/projop/.fetchmailrc
    To send an email to a project the emails subject would need to start with the project number in brackets, e.g.: [2012_0001]
c) Check if fetchmail gets mails from server and copies them to mail directory as configured  above (default: /web/projop/Maildir/new)
d) Check log file (web/projop/log/error.log) for occurrences of "Notice: im_mail_import.process_mails" to track importing process


Troubleshooting mail import

  • Import might fail due to a missing "Subject", in this case mails are moved to folder " /web/projop/Maildir/defered" 
  • Run fetchmail manually in verbose mode to see what's going on: fetchmail -v
    $ fetchmail --nokeep -s -v -K
    fetchmail: 6.3.6 querying imap.1und1.de (protocol IMAP) at Wed 23 May 2012 10:18:08 PM CEST: poll started
    Trying to connect to 212.220.10.188/141...connected.
    fetchmail: IMAP< * OK IMAP server ready H mibap7 92345
    fetchmail: IMAP> A0001 CAPABILITY
    fetchmail: IMAP< * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LITERAL+ NAMESPACE QUOTA SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN STARTTLS AUTH=LOGIN AUTH=PLAIN
    fetchmail: IMAP< A0001 OK CAPABILITY completed
    fetchmail: IMAP> A0002 STARTTLS
    fetchmail: IMAP< A0002 OK Begin TLS negotiation now
    fetchmail: Issuer Organization: Thawte, Inc.
    fetchmail: Issuer CommonName: Thawte SSL CA
    fetchmail: Server CommonName: imap.1und1.de
    fetchmail: imap.1und1.de key fingerprint: A5:3F:22:1D:C6:4B:50:72:4D:92:E7:1D:5C:30:07:D1
    fetchmail: IMAP> A0003 CAPABILITY
    fetchmail: IMAP< * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LITERAL+ NAMESPACE QUOTA SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN AUTH=LOGIN AUTH=PLAIN
    fetchmail: IMAP< A0003 OK CAPABILITY completed
    fetchmail: imap.1und1.de: upgrade to TLS succeeded.
    fetchmail: IMAP> A0004 LOGIN "xxx@project-open.com" *
    fetchmail: IMAP< A0004 OK LOGIN completed
    fetchmail: IMAP> A0005 SELECT "INBOX"
    fetchmail: IMAP< * 0 EXISTS
    fetchmail: IMAP< * 0 RECENT
    fetchmail: IMAP< * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
    fetchmail: IMAP< * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] Unlimited
    fetchmail: IMAP< * OK [UIDNEXT 40] Predicted next UID
    fetchmail: IMAP< * OK [UIDVALIDITY 1277973594] UIDs valid
    fetchmail: IMAP< A0005 OK [READ-WRITE] SELECT completed
    fetchmail: No mail for xxx@project-open.com at imap.1und1.de
    fetchmail: IMAP> A0006 LOGOUT
    fetchmail: IMAP< * BYE Server logging out
    fetchmail: IMAP< A0006 OK LOGOUT completed
    fetchmail: 6.3.6 querying imap.1und1.de (protocol IMAP) at Wed 23 May 2012 10:18:09 PM CEST: poll completed
    fetchmail: normal termination, status 1
    

  Contact Us
  Project Open Business Solutions S.L.

Calle Aprestadora 19, 12o-2a

08902 Hospitalet de Llobregat (Barcelona)

Spain

 Tel Europe: +34 609 953 751
 Tel US: +1 415 200 2465
 Mail: info@project-open.com