[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Email remote backup via pop3s



On Sat, 06 Dec 2014 09:59:00 -0300
Daniel Bareiro <daniel-listas@gmx.net> wrote:

> Hi all!
> 
> I am developing a bash script to make a local backup of the email on
> the remote mail server. The first approach was to make a backup of all
> remote email. I could develop it with fetchmail smoothly. Thus using
> the "keep" parameter, I could make the backup without deleting the
> emails on the remote server.
> 
> Now I'm trying to implement additional functionality: make a backup
> but only those emails coming from specific addresses. I had initially
> implemented this with fetchmail + procmail to only store locally the
> emails coming from those addresses, but then I realized that this
> solution does not work for this purpose because despite only it store
> emails specified, fetchmail read all emails and not only the specified
> emails.
> 
> Is there any way to download with fetchmail only the specified email
> without read other emails on the server? If not, do you know any other
> tool that can do this?
> 

POP3 is quite simplistic, there is a POP3 command (TOP) which will
effectively fetch only the message headers, which can be examined and
those messages which are desired can then be downloaded in full.
Unfortunately, TOP is not universally supported by POP3 servers.

Getmail is the other well-known POP3 downloader, but I've never used
it, I don't know its capabilities. I have a feeling that if you do find
something that does what you want this week, your needs are still
evolving and it may not do what you want to do next week.

Probably the best long-term answer is to switch to perl and to connect
directly to the mail server, rather than using a downloader. Perl has
extensive libraries to help with most tasks, unlike the various shells.
Your job would probably also be easier if your email host also supports
IMAP, which is the protocol designed for remote manipulation of email.
POP3 is really intended for dumping the whole of a remote single-user
mailbox into your workstation. It has been pushed further, but it
doesn't take long to find its limits. I have in the past used PHP to
pick SQL update commands out of chosen and validated messages in an
IMAP server, and feed them into a local SQL server, but perl is
probably more versatile.

-- 
Joe


Reply to: