LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Fetchmail with Postfix Downloading Duplicates (https://www.linuxquestions.org/questions/linux-server-73/fetchmail-with-postfix-downloading-duplicates-695808/)

Lee_Ball 01-08-2009 04:15 AM

[solved] Fetchmail with Postfix Downloading Duplicates
 
Hello all,

Long time since I've posted on here.

Here is my issue at present, I've looked around but can't seem to find a solution or even if there is one.

The problem is I have just setup a server to be an email and webmail server, however the domain it is serving email for has its emails delivered to a POP server and as this server is going to be on a dynamic IP address I'd prefer it to stay that way.

So I've setup fetchmail to download this domains emails and drop them into postfix which is installed on the server, however, until I roll the server out I need to ensure I don't make any mistakes so I'm keeping the emails on the POP server too when fetchmail downloads them, however on next poll of fetchmail it downloads them all again.

I'd prefer to keep the emails on the server so the setup is as follows:


[ POP SERVER ] --fetchmail-- [ MAIL SERVER ]


I just wondered if anyone was aware of a way to keep the emails on the server and also not have them duplicate on the system.

The fetchmail settings are:

options flush

# Check mail every X seconds
set daemon 120
set syslog
set postmaster {admin user}
set bouncemail
poll {POPSERVER} with proto POP3 and options no dns
user {pop_user} there with pass {pop_password} is {mail_user} here options ssl
smtphost localhost

Any assistance would be greatly appreciated.

billymayday 01-08-2009 06:27 AM

How are you keeping them on the server if you aren't using the "-k" option? If you are, you should be able to use "-U" in conjunction with "-k" to only download new messages.

See man fetchmail

Lee_Ball 01-08-2009 07:14 AM

Its funny you should post this reply as I've just managed to resolve it.

I did indeed need to use the -k option but didn't know about the -u option.

I was having issues getting the keep options to actually KEEP the emails, so as I'd followed a script online to create a service I took a look at the /etc/init.d/fetchmail file and modified how it starts it up by adding the -k option to it.

Here is the section:

# See how we were called.
case "$1" in
start)
if [ -s /etc/fetchmail.conf ]; then
echo -n "Loading fetchmail: "
/usr/bin/fetchmail -k --uidl -f /etc/fetchmail.conf
echo
touch /var/lock/subsys/fetchmail
else
exit 1
fi
;;


Previously it didn't have the --uidl option.


All times are GMT -5. The time now is 05:15 AM.