[Dovecot] Creating Maildir and populating with emails via external Python process
Hello:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
Thanks,
B. RIntoul
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
S°
-- Sigmentation fault. Core dumped.
This could be good. I'd never looked into the LDA - I will study up on it.
Someone else was helping out here and I thought I'd shed some more light on what I'm doing here...
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot
Maildir storage for a particular user. Now when the user retrieves their mail,
they are doing so using my Dovecot - my Dovecot instance is acting as a proxy,
of sorts...
Thanks for the responses!
(Is there an IRC channel?)
From: Sven Hartge sven@svenhartge.de To: dovecot@dovecot.org Sent: Thu, October 25, 2012 11:07:26 AM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
S°
-- Sigmentation fault. Core dumped.
On 25/10/12 21:13, Bradley Rintoul wrote:
This could be good. I'd never looked into the LDA - I will study up on it.
Someone else was helping out here and I thought I'd shed some more light on what I'm doing here...
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot Maildir storage for a particular user. Now when the user retrieves their mail, they are doing so using my Dovecot - my Dovecot instance is acting as a proxy, of sorts...
I'm intrigued by this. Why are you using some self-baked(?) python script to fetch the mail in stead of using ready-made components like fetchmail?
Unless there's a special reason not to, try using the LDA (and fetchmail/getmail for that matter).
This sounds exactly what you want: http://pyropus.ca/software/getmail/configuration.html#destination-mdaexterna...
-- Tom
Thanks for the responses!
(Is there an IRC channel?)
From: Sven Hartge sven@svenhartge.de To: dovecot@dovecot.org Sent: Thu, October 25, 2012 11:07:26 AM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
S°
I am brand new to this whole "email" thing. I am looking at this article right now: http://www.tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot
Thanks for the input!
From: Tom Hendrikx tom@whyscream.net To: dovecot@dovecot.org Sent: Thu, October 25, 2012 12:41:24 PM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
On 25/10/12 21:13, Bradley Rintoul wrote:
This could be good. I'd never looked into the LDA - I will study up on it.
Someone else was helping out here and I thought I'd shed some more light on what
I'm doing here...
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot
Maildir storage for a particular user. Now when the user retrieves their mail,
they are doing so using my Dovecot - my Dovecot instance is acting as a proxy,
of sorts...
I'm intrigued by this. Why are you using some self-baked(?) python script to fetch the mail in stead of using ready-made components like fetchmail?
Unless there's a special reason not to, try using the LDA (and fetchmail/getmail for that matter).
This sounds exactly what you want: http://pyropus.ca/software/getmail/configuration.html#destination-mdaexterna...
-- Tom
Thanks for the responses!
(Is there an IRC channel?)
From: Sven Hartge sven@svenhartge.de To: dovecot@dovecot.org Sent: Thu, October 25, 2012 11:07:26 AM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external
Python process
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
S°
From: Tom Hendrikx tom@whyscream.net I'm intrigued by this. Why are you using some self-baked(?) python script to fetch the mail in stead of using ready-made components like fetchmail?
Unless there's a special reason not to, try using the LDA (and fetchmail/getmail for that matter).
This sounds exactly what you want: http://pyropus.ca/software/getmail/configuration.html#destination-mdaexterna...
On Thu, Oct 25, 2012 at 12:54:43PM -0700, Bradley Rintoul wrote:
I am brand new to this whole "email" thing. I am looking at this article right now: http://www.tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot
I did not see where you described the ultimate goal. That should have been the starting point of this thread. Describe the problem, not how you think it should be solved, because you are new to this, and your ideas might benefit from some scrutiny. Use plain language.
I have not reviewed your howto, but personally I would recommend neither fetchmail (I'd choose getmail) nor procmail (other choices exist, depending on what you are trying to do.)
http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
Cool. Thanks for the input.
Can you tell me briefly why you'd choose getmail?
Thanks again.
B. RIntoul
From: /dev/rob0 rob0@gmx.co.uk To: dovecot@dovecot.org Sent: Thu, October 25, 2012 1:11:13 PM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
From: Tom Hendrikx tom@whyscream.net I'm intrigued by this. Why are you using some self-baked(?) python script to fetch the mail in stead of using ready-made components like fetchmail?
Unless there's a special reason not to, try using the LDA (and fetchmail/getmail for that matter).
This sounds exactly what you want: http://pyropus.ca/software/getmail/configuration.html#destination-mdaexterna...
On Thu, Oct 25, 2012 at 12:54:43PM -0700, Bradley Rintoul wrote:
I am brand new to this whole "email" thing. I am looking at this article right now: http://www.tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot
I did not see where you described the ultimate goal. That should have been the starting point of this thread. Describe the problem, not how you think it should be solved, because you are new to this, and your ideas might benefit from some scrutiny. Use plain language.
I have not reviewed your howto, but personally I would recommend neither fetchmail (I'd choose getmail) nor procmail (other choices exist, depending on what you are trying to do.)
http://rob0.nodns4.us/ -- system administration and consulting Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
Am 25.10.2012 21:13, schrieb Bradley Rintoul:
This could be good. I'd never looked into the LDA - I will study up on it.
Someone else was helping out here and I thought I'd shed some more light on what I'm doing here...
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot Maildir storage for a particular user. Now when the user retrieves their mail, they are doing so using my Dovecot - my Dovecot instance is acting as a proxy, of sorts...Thanks for the responses!
(Is there an IRC channel?)
perhaps you could use parts from here
http://wiki.dovecot.org/HowTo/RefilterMail
From: Sven Hartge sven@svenhartge.de To: dovecot@dovecot.org Sent: Thu, October 25, 2012 11:07:26 AM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
S°
-- Best Regards MfG Robert Schetterer sys4 AG Franziskanerstraße 15 Telefon +49 89 3090 4664 81669 München Telefax +49 89 3090 4666 Sitz der Gesellschaft München Amtsgericht München HRB 0000 Vorstandsmitglieder Patrick Ben Koetter Axel von der Ohe Marc Schifbauer Vorstandsvorsitzender Patrick Ben Koetter Aufsichtsratsvorsitzender Jörg Heidrich
On Thu, 25 Oct 2012 12:13:34 -0700 (PDT), Bradley Rintoul said:
This could be good. I'd never looked into the LDA - I will study up on it.
Someone else was helping out here and I thought I'd shed some more light on what I'm doing here...
Let's say someone has an account with Yahoo, for example. My Python code is fetching email from the user's Yahoo! account and placing it into the Dovecot Maildir storage for a particular user. Now when the user retrieves their mail, they are doing so using my Dovecot - my Dovecot instance is acting as a proxy, of sorts...
Thanks for the responses!
(Is there an IRC channel?)
Hi Bradley,
I'm doing almost the exact same thing, but with fetchmail and procmail. I go out and grab my email from about five different places using fetchmail, which feeds the messages to procmail, with .procmailrc deciding where in the Dovecot maildir tree to put them.
Your only need I *haven't* accomplished is having different users get their mail from my Dovecot, and to make sure each users' email goes where they can get it via IMAP connection to your Dovecot. If you can get different IMAP mailboxes for different users, you can put each user in .procmailrc so as to deliver to the correct box.
Anyway, Procmail knows exactly how to submit an email to Dovecot, so you don't need to worry about actually placing the file into the tree, or anything like that.
You mention you've written some Python code. If the purpose of your Python code is just to retrieve from SMTP servers, you can drop your Python code in favor of Fetchmail and Procmail. If your Python code actually does something with the emails, you can call a subset of your Python code from Procmail, to do its magic on each email.
Here's how my fetchmail is running:
29588 ? Ss 0:21 fetchmail -f /home/slitt/.fetchmailrc
And here's a partial view of my .fetchmailrc, showing my retrieval from Bluehost and gmail:
=================================== set postmaster "slitt" set bouncemail set no spambounce set properties "" set daemon 180
#poll mail.a3b3.com protocol POP3:
poll mail.a3b3.com protocol IMAP:
user 'slitt@troubleshooters.com' there is 'slitt' here
pass wouldnt_you_like_to_know
limit 50000000
warnings 3200
expunge 60
ssl #Use ssl encryption
sslcommonname "*.bluehost.com"
sslcertck
mda "/usr/bin/procmail -d %T" fetchall;
poll imap.gmail.com protocol IMAP user 'litttest@gmail.com' there is 'slitt' here pass 'I_just_cant_say' #portnumber 993 limit 50000000 warnings 3200 expunge 60 mda "/usr/bin/procmail -d %T" fetchlimit 50 ssl;
Do you notice the "mda" line on both pulls? That means "use procmail as your mda", which just ships each email to Procmail. Procmail knows exactly how to deliver stuff to Dovecot.
The following are the top several lines of my .procmailrc:
=================================== DEFAULT=$HOME/mail/Maildir/.INBOX/ MAILDIR=$HOME/mail/Maildir/ LOCKFILE=$HOME/mail/.lock VERBOSE=no LOGFILE=$HOME/procmail/log #GARBAGE=.garbage/ GARBAGE=/dev/null PURGATORY=.garbage/ SUPREMUM=9876543210 #PROCMAIL SUPREMUM NUMBER, SEE http://www.perlcode.org/tutorials/procmail/proctut/proctip2.pod
#### HANDLE STUFF FROM littdom@gmail.com and litttest@gmail.com ####
:0:
- ^Delivered-To:.*littdom@gmail.com .littdom_gmail/
:0:
^Delivered-To:.*litttest@gmail.com .litttest_gmail/
A few explanations: First, I couldn't include my actual filters, because they are full of very unflattering comments concerning various trolls, ignos, blabbermouths, and proudly helpless fools.
The $MAILDIR environment variable is the rood directory of your Maildir tree. $DEFAULT is the location of the main inbox for that -- I think it's where you put email that doesn't get routed elsewhere by Procmail. $GARBAGE is an environment var I made up as code for where filtered stuff gets sent. It's usually /dev/null because I don't want to see that junk again. However, I can temporarily change it to an actual IMAP directory for troubleshooting. $PURGATORY is junk that I actually want to OK the deletion of. I actually currently have nothing filtered to $PURGATORY, but it's there. $SUPREMUM is a very large number that is used in making OR logic, which is otherwise difficult. I couldn't make the $SUPREMUM env var work, so I had to use a literal, and here's a way I got all my magazines into one mailbox:
:0:
- 9876543210^0 ^From.*onsale.com
- 9876543210^0 ^From.*pcmag.com
- 9876543210^0 ^From.*itworld.com
- 9876543210^0 ^From.*networkworld.info
- 9876543210^0 ^From.*infoworld.com
- 9876543210^0 ^From.*whatsnewnow.com
- 9876543210^0 ^From.*eweek.com
- 9876543210^0 ^From.*computerworld.com .mags/
By the way, BE SURE to note the slash after the directory name. That trailing slash tells Procmail that it's delivering to a Maildir, not to an (ugh) mbox.
Anyway, I think you and I are doing very similar things, albeit for very different reasons. My motivation is that I consider all currently available email clients to be junk, and don't want them holding my email, so I hold it in a Dovecot hosted Maildir instead.
I'll be interested in how you solve this. Please keep me (and probably everyone on this list) in the loop.
Thank you so much!
SteveT
Steve Litt * http://www.troubleshooters.com/ * http://twitter.com/stevelitt Troubleshooting Training * Human Performance
On 10/25/2012 2:13 PM, Bradley Rintoul wrote:
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot Maildir storage for a particular user. Now when the user retrieves their mail, they are doing so using my Dovecot - my Dovecot instance is acting as a proxy, of sorts...
There are already a gazillion email services that do mailbox consolidation--the term for what you're attempting. Why are you reinventing the wheel? Must be a family and the dog project...
A quick browse of your Wordpress blog confirms such. It also explains why you wrote code to create maildir files from scratch. Only a programmer assumes that the first path to a solution is to write new code.
A system administrator on the other hand, most of us here, Google's for suitable FOSS, then looks in his distro repos for it, and builds from source if a package isn't available. We only script when out of Elmer's and duct tape. ;)
-- Stan
I didn't actually write code to create Maildir files from scratch, technically.
I used 15-20 lines of Python to do that and to actually fetch the mail in
addition...
Mailbox consolidation isn't the only thing which this project I'm working on requires, but it's a big part of it. :)
Anyway, I really appreciate all the advice and help!
From: Stan Hoeppner stan@hardwarefreak.com To: dovecot@dovecot.org Sent: Thu, October 25, 2012 2:02:10 PM Subject: Re: [Dovecot] Creating Maildir and populating with emails via external Python process
On 10/25/2012 2:13 PM, Bradley Rintoul wrote:
Let's say someone has an account with Yahoo, for example. My Python code is
fetching email from the user's Yahoo! account and placing it into the Dovecot
Maildir storage for a particular user. Now when the user retrieves their mail,
they are doing so using my Dovecot - my Dovecot instance is acting as a proxy,
of sorts...
There are already a gazillion email services that do mailbox consolidation--the term for what you're attempting. Why are you reinventing the wheel? Must be a family and the dog project...
A quick browse of your Wordpress blog confirms such. It also explains why you wrote code to create maildir files from scratch. Only a programmer assumes that the first path to a solution is to write new code.
A system administrator on the other hand, most of us here, Google's for suitable FOSS, then looks in his distro repos for it, and builds from source if a package isn't available. We only script when out of Elmer's and duct tape. ;)
-- Stan
On Thu, 25 Oct 2012 20:06:17 +0200, Sven Hartge said:
Bradley Rintoul brintoul@sbcglobal.net wrote:
I'm using Dovecot to provide IMAP services for Thunderbird clients. The user's mail is stored in Maildir format and the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
I am trying to create the dovecot-uidlist file and maintain the "next UID" value within it, but I am having trouble with the UIDVALIDITY and the 128 bit mailbox global UID among other things. How can I "seed" a dovecot-uidlist file with these values..?
Sorry if the information is not much to go on, please let me know what more information you might need to help point me in the right direction.
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
What is an LDA?
SteveT
Steve Litt * http://www.troubleshooters.com/ * http://twitter.com/stevelitt Troubleshooting Training * Human Performance
On Thu, 25 Oct 2012 15:31:38 -0400, Steve Litt said:
On Thu, 25 Oct 2012 20:06:17 +0200, Sven Hartge said:
How about injecting the mails into the LDA. It will take care of proper delivery without the need for your programm to know the internal workings of dovecot.
What is an LDA?
Nevermind, somebody had already answered that question. Sorry for asking too quickly.
SteveT
Steve Litt * http://www.troubleshooters.com/ * http://twitter.com/stevelitt Troubleshooting Training * Human Performance
On 10/25/2012 1:01 PM, Bradley Rintoul wrote:
the individual emails which the user "receives" are actually downloaded and put into the Maildir "repository" using a Python email client (POP3 client).
Tell us more about this. This doesn't sound like 'normal' email being fetched from an external service provider over a slow link scenario. This sounds more like an application server generating data files that are then POP'd down to the Dovecot server. Assuming that for now...
If you're able to run a popd on this application server, why not run a simple smtp MTA and send these files directly to the user email addresses? Injecting the payload is a pretty simply shell command line, or from within a Python/Perl/etc script. Dovecot handles the rest as it arrives. Problem solved.
The more you can do with smtp the better off you are and the easier it is.
-- Stan
participants (7)
-
/dev/rob0
-
Bradley Rintoul
-
Robert Schetterer
-
Stan Hoeppner
-
Steve Litt
-
Sven Hartge
-
Tom Hendrikx