Here's a recipe for Qmail that I used many years ago when experimenting with using FUDFORUM and MAILMAN to get something like the functionality that OGM will provide. In the comments are also references to other recipes including POP mailboxes and a method I devised for using Mailman's external archiver functionality to effectively use Fudforum as the archive instead of Mhonarc.
These ideas should be adaptable for OGM.
http://fudforum.org/forum/index.php?t=msg&th=4519&start=0&
Thanks for the great work you are doing here.
I'm not a programmer but have tinkered with qmail quite a bit over the years so could contribute in this area. I'd be happy to help work on this once I get some breathing space in August. Ping me (anyone) if you want to collaborate on getting OGM working with qmail, which comes standard on all Plesk servers and is widely used.
Cheers,
Tobias
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | mailwrapper.pl_.txt | 1 KB | tobias |
Comments
Comment #1
tobias commentedHi Kyle -
I am looking at the EXIM files and it seems to me that we should be able to do this quite easily with qmail on Plesk servers. Please correct me if I am wrong! :)
Here's how I would do it - can you help get the scripts to work?
1) create a dedicated domain for incoming mail for the mailing lists and have all mail for the domain routed to a single mailbox (I have set this up already through the Plesk control panel, eg foo@groups.bar.com)
2) in the qmail home directory for the mailbox (eg /var/qmail/mailnames/group.bar.org/foo)
create a file called .qmail-default containing a line like this:
|preline /usr/bin/php /var/path/to/og_mailinglist_qmail_transport.php
This, as you can imagine, pipes in the message and sends it raw to the transport script.
Cheers,
Tobias
Comment #2
tobias commentedKyle -
In the transport script, what are these variables:
// Set command line arguments (sent by the exim4 transport) to variables.
$mail_username = $argv[1];
$mail_domain = $argv[2];
is it the destination username@domain? On qmail, these variables are not passed at all. The script would have to parse the email to get the destination address and thus the group name - or bounce mail to unknown username.
Cheers,
Tobias
Comment #3
tobias commentedHi Kyle,
I've been doing some more troubleshooting and am not succeeding in even running the drush command. Can you shed some light? See drush output and messages below. First copy/paste is how it looks with your code. Second copy/paste is after I changed function names as advised by drush.
Meanwhile, my qmail setup is generating the same errors as below on the commandline so I think I am on the road, unless I am missing something.. here's the line in my .qmail file for the default maildrop I am using for ogm. First line includes a log record for each mailing, the second line also saves received mail to a maildir for troubleshooting.
Cheers,
Tobias
-- CUT HERE ONE --
-- CUT HERE TWO AFTER FIXING FUNCTION NAME IN og_mailinglist.drush.inc --
Comment #4
kyle_mathews commentedYou're missing some parameters for the drush command.
Look at the og_mailinglist_exim4_transport.php file and how it is calling the drush command.
The executed drush command looks something like
drush @mysite /tmp/121233 test-group. That's what your qmail script will have to do as well.BTW, are you using the latest code? I hadn't done a push of code of d.o. for quite awhile and just barely pushed the last 3-4 months of changes from github to d.o. this morning and rolled a 3rd alpha.
Also, if this isn't urgent, I'm going to be doing away with the drush system soon anyways so it might not be worth your while to get this working. The new system will use the mimemail module and will work by having a script do an HTTP POST of new emails to your drupal site. The drush thing works for the most part but it's way way too hard for most people to set up and is rather fragile as a number of files have to have the right file permissions set. See #782360: Replace the current Drush system for handling incoming mail with a mimemail-inspired POSTing system for more info.
Comment #5
tobias commentedHi Kyle -
Thanks for the quick reply. I am using the latest code from github, not d.o.
What is
drush @mysite /tmp/121233 test-group? Doesn't seem to match what I think drush would do. I just tried the following with no success:drush -v -d ml.kb2.org sites/all/modules/contrib/og_mailinglist/testing/applemail testThe error:
The drush command 'ml.kb2.org ogm-post-email sites/all/modules/contrib/og_mailinglist/testing/applemail test' could not be found. [0.59 sec, 15.47 MB]I'm happy to stop trying until you roll the next release without drush, but I am eager to help and get involved in the project. The sooner I can get it working on qmail the better, as far as I am concerned - any help from any coder to get this done would be much appreciated.
Thanks!
Tobias
Comment #6
kyle_mathews commentedWoops, my bad. I mis-typed the drush command.
It should be
drush @mysite ogm-post-email /tmp/121233 test-groupBut yeah, it's probably not worth your effort until I can roll out the new code. Hopefully I'll get to it later this week.
Comment #7
tobias commentedHi Kyle,
Thanks for the reply.
I'm pleased to report that this morning, with a fresh head, I was able to get this working on my qmail system with my mailwrapper.pl script (see attached) placed in the qmail default mailbox home dir eg
/var/qmail/mailnames/foo/barcalling e.g.drush -r /path/to/httpdocs -l http://foo.com ogm-post-email $filename test- messages to test@foo.com are piped through and posted to the test group. I am having the problem though that it is recursively sending messages forever until I disable the dot-qmail file - presumably something related to your Exim instructions about allowed site domains which I still need to get my head around.I am also getting this error even when it successfully posts:
My mailwrapper.pl script is not currently able to extract the first part of the email address of the list and send it through to drush as a variable as required, though it is able to extract the full email address. A programmer may be able to change the script to get the first part of the email address -- or could you adjust your script to accept the full email address and parse out the first part?
Would welcome input from others interested in qmail at this stage. Thanks!
Cheers,
Tobias
ps - and for future reference, mailwrapper.pl requires the Mail::Internet module from CPAN, which I was able to install easily on my system using the "cpan install Mail::Internet" command.
http://search.cpan.org/~markov/MailTools-2.06/lib/Mail/Internet.pod
Comment #8
kyle_mathews commentedI've removed the drush integration in favor of a much simpler method for POSTing emails. See #782360: Replace the current Drush system for handling incoming mail with a mimemail-inspired POSTing system, the function og_mailinglist_post() in og_mailinglist_transport.inc and the new installation instructions for exim. I think getting qmail working should be a lot simpler now. I'll be rolling a new alpha next week but for now, grab it from github.
Comment #9
tobias commentedHi all,
I think with the new changes, I will still run into the same problem I have with my qmail wrapper not being able to extract the username portion of the email address so that the transport script can direct the message to the appropriate organic group. Would welcome a contribution from a programmer to either hack my wrapper to get this working (see above) or to write a new one that can replicate EXIM's functionality.
Alternatively, maybe Kyle could adjust his script to extract the destination username from the piped email so that it is more MTA agnostic?
Cheers,
Tobias
Comment #10
kyle_mathews commentedPulling the destination username aka group name from the email w/ code sounds like a reasonable solution. Since Exim gives it to you nice and easy I'd thought other MTAs would as well.
I'll figure that out tomorrow or Tuesday and commit it.
Comment #11
tobias commentedthat sounds great - thanks, kyle! :)
Comment #12
tobias commentedHi Kyle,
I've now got OGM working on my qmail system using your new, improved and drush-free method. All that remains to get full qmail compatibility (unless I am missing something) is to get the OGM script to parse out the group username and domain name which my recipe does not extract and pass to the OGM script.
Here's the recipe so far:
1) create a domain for the email side of OGM with a default mailbox for all mail to the domain (eg foo@group.bar.org)
2) copy the
og_mailinglist_exim4_transport.phpfile into the home dir/var/qmail/mailnames/group.bar.org/foofor the mailbox and set the ownership to bepopuser:popuser3) in the default mailbox, create a .qmail file containing the following lines:
The first line pipes the incoming email into the test@group.bar.org group and appends the ogmtransport.log file.
The second line also archives the email for troubleshooting/archival purposes.
That's it! I also had to make a tweak to the og_mailinglist_api.inc file to change the path to PEAR on my Plesk system to
/usr/share/pear/Mail/mimeDecode.phpCheers,
Tobias
Comment #13
kyle_mathews commentedAwesome! Glad it's finally working :) Your recipe looks solid and pretty easy to follow. One thing that could be improved perhaps for a noob qmail user is Step #1. I'd have no idea about how to go about setting up a domain mailbox for qmail. So if you could write a step-by-step guide for that, I think the rest can just be pushed into a qmail_og_mailinglist/INSTALL.txt file.
I added a few other options for grabbing the mimeDecode library including yours http://github.com/KyleAMathews/og_mailinglist/commit/1f90f8c05271952a9ab...
Comment #14
kyle_mathews commentedOGM doesn't require $mail_username anymore.
http://github.com/KyleAMathews/og_mailinglist/commit/51590faf9ab83acb86f...
Comment #15
tobias commentedLovely! I have pulled your latest version from git and tested it on two lists. Your changes appear to be working perfectly, also for me on my qmail system.
I've pasted in a draft INSTALL.txt file with qmail instructions below. Feel free to adjust and use in a new qmail install folder as you like.
As regards step 1: I would hope that anybody running qmail would be familiar with the lifewithqmail.org site (http://www.lifewithqmail.org/lwq.html) which explains how to set up catchall addresses (what I called "default addresses" above). Also, if you are using plesk (as I am) then you can create the catchall using the plesk control panel. I found some video tutorials for various versions of plesk, of which this seems a typical one, for plesk version 8: http://www.webhostingresourcekit.com/flash/plesk-8-linux/plesk8linux_cat...
This is major progress - thank you! Finally I feel like I can see the results of the work you are doing and start helping in a concrete way. Here's looking forward to the beta! :)
Cheers,
Tobias
Comment #16
kyle_mathews commentedLooks lovely! Instructions commited with minor edits: http://github.com/KyleAMathews/og_mailinglist/commit/cd34b50cc43aa3392a3...
Comment #17
tobias commentedGreat - thanks Kyle!
Please update the URL near the top, which got munged by drupal.org. It should be:
http://www.webhostingresourcekit.com/flash/plesk-8-linux/plesk8linux_cat...
Cheers,
Tobias
Comment #18
kyle_mathews commentedFixed: http://github.com/KyleAMathews/og_mailinglist/commit/5d4de1a07a68cb4e90e...
Comment #19
kyle_mathews commented