|
Setup DMS fetchmail:
First of all: install fetchmail
# yum install fetchmail |
then you need to edit
/opt/fetchmail.script
#! /bin/bash fetchmail -q fetchmail -v -k -p pop3 --auth password -f /etc/fetchmailrc --logfile /var/log/fetchmail.log --invisible --smtphost 192.168.1.71 --smtpaddress serviva.com -d 300 |
this kills any existing fetchmail processes, then
starts fetchmail in Pop3 Mode (Imap is too tricky)
-auth password tells it to read that part from the file fetchmailrc
-logfile tells it where to store the log
-smtphost is the dms host itself (“postfix” should work too, as well as any fqdn)
-d 300 means that it should use a delay of 5 Minutes between fetches
note: ensure to make the fetchmail.script file accessible for your below mentioned linux user ("fetchmail" as user) and executable at the same time. (thus the 755 pattern)
# chmod 755 /opt/fetchmail.script |
then edit /etc/fetchmailrc
defaults proto pop3 set logfile "/var/log/fetchmaillog" poll pop.1und1.de proto pop3 user "serviva@epmanagement.eu" pass "mypassword" is "dms1" keep |
most important setting is “keep” to keep the polled emails on the server. If you omit this, the polled mails will be deleted from the pop3 (exchange) server which might result in a shitstorm.
The file fetchmailrc can hold as many mail accounts as you like.
create User fetchmail
# adduser fetchmail # passwd fetchmail # usermod -aG wheel fetchmail |
now make fetchmail the owner of the file /etc/fetchmailrc
# chown fetchmail /etc/fetchmailrc |
And set that file to exclusive for user fetchmail
# chmod -v 600 /etc/fetchmailrc |
then try if the user is working
# su fetchmail |
whilst in the user fetchmail create a cronjob
# crontab -e 30 * * * * /opt/fetchmail.script |
Result:
Fetchmail picks up new emails from the defined email inboxes and delivers them to the postfix of DMS. This happens every 5 Minutes and the whole job is reinitiated every 30 minutes.
There is a lot more detail, hundreds of fetchmail tutorials or the man page of fetchmail. This is my own cheatsheet and is by no means complete or all encompassing.
Verwandte Artikel erscheinen hier basierend auf den Stichwörtern, die Sie auswählen. Klicken Sie, um das Makro zu bearbeiten und Stichwörter hinzuzufügen oder zu ändern.
|