Fetch mail thru pop3 and send it to an smtp server

written by Admin


Posted on 2013-06-21


Problem

I want to fetch all messages delivered to a pop3 server and send them on an smtp server.

Solution

After installing fetchmail (if necessary)
# apt-get install fetchmail

...start it as a daemon
# fetchmail -v -S mysmtpserver -D mydomain.tld --sslproto '' -d 60
(where mysmtpserver is the ip of your smtp server and mydomain.tld is your domain)

after putting these lines in .fetchmailrc in your home directory
poll mail.mydomain.tld
  protocol POP3
  user "me@mydomain.tld"
  pass "mypass"
  is "me@mydomain.tld"
(where me@mydomain.tld is your email address and mypass is your password)


Put the fetchmail command in /etc/rc.local to restart it after reboot.

It works very well also with an IMAP server, changing the "protocol" parameter in the configuration file.

Feedback


Comments

Leave a Comment:

Search

Welcome

We need collaboration and a real boost from our community: write us an email for every trick you find!

This website is a sysadmin swiss-knife for every-day Windows, Linux and Mac administration and troubleshooting

Our database grows if YOU send us your tips and trick as soon as you find them every day!