create repeating imap/pop3 import

Issue #1294 resolved
IT created an issue

Hello,

i read the docs and can’t find a helpful answer for this question.

Question:
How can i import mails with IMAP / POP3 every x minutes, instead of receiving them with SMTP?

Why:
SMTP needs a open port and a static IP address.

How:
my idea add a import command to the crontab

*/5 * * * * pilerimport -i imap.srv.com -u usr -p mypassword -r

Is that the way to go?

Imap with - r is possible or should i use POP3 ?
https://www.mailpiler.org/wiki/current:importing-emails
-r Remove imported emails

IMPORTANT! pilerimport doesn't change or delete the imported file, only reads it.

So -r is not working !?

Can you provide a working example ?

Thank you

Comments (7)

  1. Janos SUTO repo owner

    Well, pop3 is a much simpler protocol. You may try using it, eg. pilerimport -K pop3.server.com -u user -p yourpassword -r

    The -r option should work for pop3. Or you may try the imapfetch.py utility. Basically it only downloads (and optionally removes) emails from an imap mailbox, and then you may run pilerimport to process these emails.

  2. IT reporter

    IMPORTANT! pilerimport doesn't change or delete the imported file, only reads it.

    does this statement refer to the pilerimport without -r ?

  3. Janos SUTO repo owner

    That statement is somewhat misleading, I’ve just removed it. So pilerimport removes the successfully processed (either stored, duplicate or discarded) file when using the -r option.

  4. Janos SUTO repo owner

    Great. However, imapfetch.py only downloads the email, but you need to run pilerimport to process those emails.

    Also there’s no guarantee that your simple cron job completes in 5 mins, I’d use a bash script to run both imapfetch.py and pilerimport, and add a mechanism, eg. flock to prevent concurrent runnings.

  5. IT reporter
    */5 * * * * flock -n /tmp/piler_import.lock -c "cd /tmp && pilerimport -i Imap.yourdomain.com -u journal@yourdomain.com -p yourpassword -P 993 -r"
    

    pilerimport is doing all, download, delete and process

    thank you

  6. Log in to comment