<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Steve Litt" &lt;slitt@troubleshooters.com&gt;<br><b>To: </b>ale@ale.org<br><b>Sent: </b>Tuesday, January 3, 2017 12:50:40 PM<br><b>Subject: </b>Re: [ale] Fetchmail IMAP backup<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;">On Tue, 3 Jan 2017 10:14:53 -0500 (EST)<br>Chris Fowler &lt;cfowler@outpostsentinel.com&gt; wrote:<br><br>&gt; I'm a bit confused on what I can do with fetchmail with IMAP.<br><br><br><br>&gt; <br>&gt; I want to connect to a remote IMAP server, fetch email, but not<br>&gt; delete them (keep). I want to do this all the time so that I can use<br>&gt; procmail on where fetchmail is running to search these emails, sort<br>&gt; them based on criteria. <br><br>poll mail.bagelpatunias.com protocol IMAP:<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;user 'slitt@bagelpatunias.com' there is 'slitt' here<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pass 'wouldnt_you_like_to_know'<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;limit 50000000<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;warnings 3200<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;expunge 60<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mda "/usr/bin/procmail -d %T"<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fetchall<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ssl;<br><br>To leave the mail on the IMAP server, eliminate the expunge command<br>(try it to make sure, I've been wrong before).<br><br>&gt; <br>&gt; You can't use fetchall and keep in daemon mode<br><br>My experience is that fetchmail keeps running til you stop it.<br></blockquote><div><br></div><div>It can be either. &nbsp;I know when I told it to keep and fetchall it ran, but had a nasty warning that "it will not work". &nbsp;I can understand why.</div><div>I've been running fetchmail in daemon mode for each user for 10years+. &nbsp;I was a noob then and have not updated the config. &nbsp; One benefit is that for me I can poll every 60s. &nbsp;They every 5 minutes. &nbsp;I need to react to emails I receive. &nbsp; I'm in the process of redoing that server. &nbsp;My goal for the upgrade is to change to spamassassin as daemon, clamav as daemon, and one fetchmail for all. &nbsp;I'm still the middle man between our email and our Zimbra provider. &nbsp;I feed our provider email with a program I wrote that send it to them. &nbsp;That program needs an update to support spooling and throttling via a token bucket. &nbsp;They have disabled my account a few times due to the email sent to me being sent at a rapid pace due to our server going to 0% disk left. &nbsp;Fetchmail keeps going after the same stuff, dominoes fall, boom! &nbsp;I can stop this, but I'm lazy. :)</div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><br>&gt; &nbsp;and I can't figure out<br>&gt; how fetchmail knows what it has fetched in the past. <br><br>I don't know either, but my guess would be that it marks the downloaded<br>messages as "read". Which is a disadvantageous side effect.</blockquote><div><br></div><div>It does not. &nbsp;If I stop and start it back it starts at 1 of 14,000. &nbsp;I am not sure if I can specify an epoch on the command line of fetchmail. &nbsp;I really don't require fetchmail to know. &nbsp;If I can tell it then I can do it. &nbsp;Programming gives me some options. &nbsp;Maybe Perl with IMAP client and I do myself? &nbsp;I don't know yet. &nbsp;I'm more apt to use programs that do a better job than I'd do. &nbsp;Especially those that have been updated and doing that job for a long time. &nbsp;Fetchmail is more of an expert at fetching IMAP than me. &nbsp;I know that it does not log message # or anything else. It passes it right to procmail</div><div><br data-mce-bogus="1"></div><div>Damn! I just saw this</div><div><br data-mce-bogus="1"></div><div>fetchmail: reading message XXXXXXXX:8159 of 14314 (709 header octets) (1936 body octets) not flushed<br>fetchmail: Received BYE response from IMAP server: MAILBOX IS IN INCONSISTENT STATE, PLEASE RELOGIN.fetchmail: socket error while fetchin</div><div><br data-mce-bogus="1"></div><div>A start up puts be back to 1 of 14,314</div><div><br data-mce-bogus="1"></div><div>I do see this in man page</div><div> </div><div><br data-mce-bogus="1"></div><div>-i &lt;pathname&gt; | --idfile &lt;pathname&gt;<br> (Keyword: idfile)<br> Specify an alternate name for the .fetchids file used to save message UIDs. NOTE: since fetchmail 6.3.0, write access to the directory containing the idfile is required, as fetchmail<br> writes a temporary file and renames it into the place of the real idfile only if the temporary file has been written successfully. This avoids the truncation of idfiles when running<br> out of disk space.<br></div><div><br data-mce-bogus="1"></div><div>I'm thinking what I can do is if that file does not exist do 'fetchall'. &nbsp;I'm testing now</div><div><br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><br><br>&gt; The mailbox<br>&gt; belongs to a user who needs his email and we need to automatically<br>&gt; sort incoming email that is sent to him. <br><br>Huh? Sort? Sort how? To what end? Are you saying you want to move<br>messages to various folders on the IMAP directory? Eeeuuuuu!<br><br>Is this user so unreasonably stuck in his work procedures of the past<br>that he's willing to make you jump through these kinds of hoops? Is<br>this guy paying you?</blockquote><div><br></div><div>No. &nbsp;He is not paying me. &nbsp;I would not follow him anyway.</div><div><br data-mce-bogus="1"></div><div>I'm not moving anything on IMAP. &nbsp;He has a lot of mail and I need him to do auditing of data where the accurate data exists in his INBOX.</div><div>To make it easier I'm making a copy of his INBOX and am filtering all those emails we need. &nbsp;Since I can program too I have MANY options of making it even more easier. &nbsp;We are going after serial numbers. &nbsp;I can search for serials in each email and then add a copy to a file for that serial number.</div><div>Some of these emails have a XLS attachment with many serials. &nbsp;Perl SpreadSheet::ReadExcel can allow me to grok those with regex.&nbsp;</div><div><br data-mce-bogus="1"></div><div><br></div><div>This helps us to audit, but it is also a great idea for now on. &nbsp;</div><div><br data-mce-bogus="1"></div><div>If I had to do this auditing myself I'd be doing what I just wrote above. &nbsp;No way I'm going through 14K emails. &nbsp;If I had to I'd hire my "butler" do copy them all to a folder first. &nbsp;I'd then think about editing an Excel sheet with the email, but end up hiring my butler to do that too. &nbsp;I'm not paying my butler to do this because if the person that needed this had done it a few years back when I told him too he'd be thankful today. &nbsp;It was not much work then. &nbsp;A lot of work now!</div><div><br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><br><br>&gt; <br>&gt; My idea is to use fetchmail on a computer to attach to his IMAP as an<br>&gt; IMPA client, download, and process via procmail. <br><br>HIS IMAP? Wait a minute. Does he have HIS OWN IMAP, under your control?<br>Is his IMAP constructed with Dovecot? If so, I think I've already solved<br>this problem. I thought you meant his IMAP was on Google Mail or<br>something.</blockquote><div><br></div><div>It is now. &nbsp;Last night while driving from NC to GA the gears in my head was working on this problem. &nbsp;I originally was going after Zimbra IMAP, but these emails go through our Dovecot first. &nbsp;I have access to 100% of that. &nbsp;It is one huge MBOX file in /var/spool/mail/USER because he does not use IMAP folders.</div><div><br data-mce-bogus="1"></div><div>mbox2mdir then I just grok each one as a file. &nbsp;We are done, problem solved. &nbsp;</div><div><br data-mce-bogus="1"></div><div>Working this from my desktop as external to the Dovecot allows me experience so that when I transfer over all email control to the provider I can do backups, external data gathering, etc using what I learned today.</div><div><br data-mce-bogus="1"></div><div>One thing I need to do on the Dovecot side, but not related is to process MOBX file though spamassassin and clamav. &nbsp;We do incoming backups of all and those files are huge. &nbsp;I was sick of telling folks I could not "undelete" things they deleted so we started incoming backups. &nbsp;Those are done pre-spamassassin. &nbsp;To correct this I need to move the rule to after spam detect and then process the data we have created before&nbsp;the screw up to remove the noise.</div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><br><br>&gt; I'll look for some<br>&gt; criteria and then I'll send it to a perl program that will even<br>&gt; search XLS files that are attached for criteria. <br><br>I'm not exactly sure what benefit you're trying to give your user, but<br>I'm almost positive there's a better way to do it.<br></blockquote><div>Once I'm done and this continues to sort externally it will be a gift to him. &nbsp;The better way to do it is for him to update XLS as he receives&nbsp;</div><div>this stuff. &nbsp;He's been against doing work since he started football in high school almost 50 years ago. :)</div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;">SteveT<br><br>Steve Litt <br>December 2016 featured book: Rapid Learning for the 21st Century</blockquote><div><br></div><div>The most rapid learning I provide my guys is "You will not do that again will you?"</div><div><br data-mce-bogus="1"></div><br></div></div></body></html>