Re: Email remote backup via pop3s
On 06/12/14 10:39, Joe wrote:
>> 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
>> 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.
Yes, yesterday looking for other alternatives, I found "getmail".
Although my situation is the same as yours; I'd never tried it. I should
investigate a little more in depth.
Alternatively, changing the perspective to implement this, I got to
thinking about whether it would be feasible to implement it using IMAP
(I would have to check whether the remote server supports IMAP)
The idea is to cover these features:
* Get all emails.
* Don't delete the retrieved emails from the mail server.
* Optionally, get emails which were sent from specific email addresses.
* Optionally, time frame for collecting emails (collect emails from DATE
AND TIME to DATE AND TIME).
* Copy all content of the collected emails to a new unicode text file
(maybe mbox format).
Thanks for responding.