Closed (fixed)
Project:
OG Mailinglist
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Oct 2010 at 04:17 UTC
Updated:
3 Jan 2014 at 02:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
letapjar commentedComment #2
lp commentedThis is a problem for me as well, and also for a number of organizations that I would encourage to use OGM if it weren't for this block. I mentioned this to Kyle, and he indicated that it's potentially quite a challenge, and perhaps is not a suitable immediate goal.
An option that was brought up is to create a structure similar to Aquia Search, whereby a host provider could provide a backend that allows accounts to drop in OGM. I suppose (though I'm technically less knowledgeable than anyone else in this queue) that the backend could even be on a completely separate server, e.g. I could run an OGM backend for non-profits if I chose, or charge for bandwidth and allow open access. See my ticket on Mayfirst, a host with a mission that perfectly compliments OGM.
Comment #3
kyle_mathews commentedThe magic function for you is _og_mailinglist_process_email(), found within og_mailinglist_transport.inc. Right now, how things work is that ogm has integration with a number of MTAs (e.g. postfix, exim) such that when they receive an email they do an HTTP POST to yoursite.com/og_mailinglist where we have a menu handler which passes off the information to og_mailinglist_post().
That works nicely.
To get this working on a shared host, you'd need to do as LP and setup another server that can handle email and post the emails to your shared host, or figure out some other way of fetching the email and pushing them to _og_mailinglist_process_email(). Mailhandler might have some interesting ideas - http://drupal.org/project/mailhandler as might this post on g.d.o. that started off this hold shebang - http://groups.drupal.org/node/42688.
Comment #4
letapjar commentedi just noticed that my host (greengeeks.com) allows me to choose what to do with unrouted email - including piping it to a program.
So is there a way to pipe to the _og_mailinglist_process_email() function?
what would happen to the emails that the function rejects? Basically we'd need to have an ultimate email box that all non-list email still dumps to after being processed.
I think any shared host offering cpanel shuld have the above functionality - so if we can figure this out - i.e. setting up the process_email function plus a dump mail box - the ogm could be used by a large numbers of folks on shared hosting?
Comment #5
kyle_mathews commentedThat's very exciting. I didn't know shared hosts offered that sort of thing (I almost never use shared hosts). So yes, if that works as described, then you're very close to getting this working. To get the email from your host to your Drupal site, you'll need to do an HTTP POST of the email to your drupal site. Look at the og_mailinglist_exim4_transport.php file. Particularly the part at the end. You'll need to setup something similar for shared hosts which a) pull in the email into your script, b) figure out which Drupal site the email is for, c) generate a token, and d) POST the email and token to the Drupal site.
If ogm gets an email for a group that doesn't exist or from a user who isn't a member of the site or the particular group they're trying to email then the email is rejected and that person is sent an emailing explaining why the email was rejected.
It isn't possible right now to forward on rejected emails to some sort of ultimate email box. But I don't think that's really necessary. Like you said, the only emails that would be sent to ogm would be emails that no one else picked up. So if they aren't accepted by ogm, that means they're probably spam.
Yeah, there's lots of people interested in this. Get a proof of concept going and I'm sure we can get a number of other people to test out what you're doing.
One other note -- this issue, #911974: Send all emails through PHPMailer removing dependency on having a Sendmail compatible server needs to be solved most likely before ogm will work on shared hosts because ogm right now requires you to be able to use exec() and requires a Sendmail compatible MTA to be installed and accessible on your server.
Comment #6
letapjar commentedKyle,
do the proposed patches for phpmailer and og_mailinglist_utils.inc in the other thread resolve the issue?
I also just noticed that my cpanel offers what is called "account email filtering" which allows one to define rules for incoming messages and treat them differently - again including the option to "pipe to a program" so this might be the easiest way -
Rule: if the TO email address includes "groups-" (using - instead of + for subaddressing) Then pipe to the og_mailinglist_exim4_transport.php - and then I woul djsut put the validatio token etc. into that script.
I will try this out over the next day or two and let you know how it works.
Comment #7
kyle_mathews commentedNot yet... I need to comment over there but I've been busy lately.
I don't know if that rule would work generally as many groups aren't going to have "groups" as part of their group title. Perhaps it'd be better to have your emails sent to a subdomain such as lists.example.com or groups.example.com so a group email address would be a-group@lists.example.com?
Comment #8
letapjar commentedI don't have a subdomian set-up on my site - but this part of the proces would be done in cpanel and so either configuration could be done.
Comment #9
letapjar commentedKyle,
I'm having trouble getting the router and transport functions to work correctly - I notice the og_mailinglist_exim4_router.php
requires "sites_aliases.php"
and it make a call to drush
there is nothing in the og_mailinglist documentation about a dependency on drush and I don't have drush installed AFAIK. and I can't find a site_aliases.php file.
Since I have now set-up a subdomain (groups.mydomain.com) - is there a way to bypass the og_mailinglist_exim4_router.php and og_mailinglist_exim4_transport.php files ?
Comment #10
tobias commentedHey latapjar,
You can create the site_aliases.php file based on the code at the end of the INSTALL.TXT file in the exim_og_mailinglist dir.
There is also no longer a drush requirement -are you getting the latest code from github?
You can try piping it to a program the way I do in .qmail - with a line like this:
|preline /path/to/og_mailinglist_exim4_transport.php groups.kabissa.org
You'd have to makes ure it's executable by the popuser (or whatever) user.
cheers,
tobias
Comment #11
letapjar commentedthanks - I've never used git some I took the code from the drupal.org project page (beta2) and patched using the phpmailer patches from the other thread.
Looks like site_aliases and site_info are two different things. - The router looks for site_aliases and the transport looks for site_info.
I'll spend some more time mucking around in the code.
Comment #12
tobias commentedAh - yes, so you don't need to bother with the site_aliases. that is an exim specific thing. sorry to not be reading carefully. :)
you do need to get the code from github though - it's much newer than what's on d.o. and it's what we're all using so we can't help you as easily if you run into trouble.
http://github.com/KyleAMathews/og_mailinglist
cheers,
tobias
Comment #13
kyle_mathews commentedI actually made a beta3 release on Friday so the d.o. could is almost completely caught up with the github code. But that og_mailinglist_exim4_router.php file shouldn't even be there. Evil CVS strikes again! That was for an older technique I used w/ the Exim integration that isn't used anymore. So please ignore any code there.
Also, while the Exim and QMail integrations can provide a guide for what you'll need to do to get a shared host working, you won't be using those files (they're only useful for Exim and QMail) and you should only loosely follow them as a guide as again, they were both written specifically for Exim and QMail so much of what we had to do there won't apply to your situation.
Comment #14
letapjar commentedOK I will try pulling code from github - the beta3 still has the exim4_router.php file by the way (I ignored it)
So Far outgoing emails are working fine on creation of new posts and on new comments - but handling of emailed replies is a fail.
Comment #15
tobias commentedHi Letapjar -
Is it actually cpanel that you are using? If so, then there should be, as you say, a way to "pipe email to a program". The CiviCRM forum has a topic on a similar issue that might help you: http://forum.civicrm.org/index.php/topic,1973.msg8646.html#msg8646
Cheers,
Tobias
Comment #16
letapjar commentedTobias - that is exactly what I am doing - the probelm is getting the transport script to actually post to the og_mailinglist url correctly. still working on it.
Comment #17
letapjar commentedOK I am stumped - I get the following error:
Failed opening required 'sites/all/modules/og_mailinglist/og_mailinglist_transport.inc' (include_path=''.:/usr/lib/php:/usr/local/lib/php:/home/my_cpanelusername/php'') in /path/to/mydomain/includes/menu.inc
this tells me that the og_mailinglist_exim4_transport.php is making the CURL call to the post url - but somehow my path settings are not allowing the function to run?
Any suggestions out there?
Comment #18
kyle_mathews commentedI would check
a) if that file is actually there.
b) if clearing the caches fixes things (go to admin/settings/performance and to the bottom of the page).
c) that the file permissions aren't preventing your web server from reading the file.
Comment #19
letapjar commentedok - sheepish grin - somehow I deleted that file. I'll have to figure out my php PEAR include paths now as the script still can't find Mail_mimeDecode.
Comment #20
letapjar commentedSo far this is what works on my shared hosting environment:
1)If a new group post is made on the website - an email gets sent out to the group members who are subscribed to receive emails.
2) If a group member replies to an email - a new comment is created on the relevant post
3) If a group member sends a new email to the group email address - or changes the subject line when replying to a group post - then a new post is created
Here is what is not working:
3) When a group member replies by email - or crates a new thread by email - the outgoing emails fail with the following message:
=================================================
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to |/home/mycpanelusername/addons/mydomainname.com/sites/all/modules/og_mailinglist/og_mailinglist_exim4_transport.php
generated by testgroup@groups.mydomainname.com
The following text was generated during the delivery attempt:
------ pipe to |/home/mycpanelusername/addons/mydomainname.com/sites/all/modules/og_mailinglist/og_mailinglist_exim4_transport.php
generated by testgroup@groups.mydomainname.com ------
X-Powered-By: PHP/5.2.14
Content-type: text/html
sites_info.php:
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Sat, 30 Oct 2010 14:08:20 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.14
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0
Set-Cookie: SESS04d8ee1325756d74c4081e0ecb1f1121=e1f410c9a544b143af534893fbcbcfff; expires=Mon, 22-Nov-2010 17:41:40 GMT; path=/; domain=.mydomainname.com
Last-Modified: Sat, 30 Oct 2010 14:08:20 GMT
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
'Array
(
[1] => og_user#1@gmail.com
[2] => og_user#2@gmail.com
)
===========================================================
Above I have substituted for the cpanel user name and domain name and email addresses.
Part of the problem is in my domain configuration since I had to manually copy the mimeDecode.php and PEAR.php files to the og_mailinglist directory for the script to work at all (this is an include path config problem)
but - I can't understand why the outgoing emails work when a thread is created from the web - but not when they come from email - any thoughts or suggestions of where to look would be appreciated - I feel this is very close to working on a shared host which would really make OGM useable by a lot of folks.
Comment #21
letapjar commentedOK so one potential issue I found:
In og_mailinglist_utilities.inc
the function og_mailinglist_mimeDecode_load_library()
checks a lot od default places for the pear mimeDecode.php file - but it does not really check along the defined include path.
By this I mean : on a shared host, cPanels allows one to install optional PEAR packages (like Mail_mimeDecode) but it may put them in a directory off the user's home directory.
I can use a set_include_path() call in my settings.php to have that directory included - but this load library function bypasses the include path.
I have fixed it by adding an additional check ahead of all the others that simply tries to include_once('Mail/mime_decode.php');
this function call would check along the regular php include_path and include the files correctly.
Kyle do you want me to create a separate issue for this and submit a patch?
Comment #22
kyle_mathews commentedWow! Great work! I'm guessing the problem is still related to #911974: Send all emails through PHPMailer removing dependency on having a Sendmail compatible server Look at the _og_mailinglist_send_raw_email() function. Until we can the other issue fixed, ogm can only send out email through a sendmail-compatible server. Which a shared host definitely isn't. I'll see if I can put in some more time on that issue next week. I have some ideas about how to solve it.
On the include path problem, yes please start another issue and a patch if you could and I'll commit that. Thanks!
Comment #23
nigelcunningham commentedHey Kyle - on that last point, when drupal.org was down and I sent you my last post on that issue privately, you mentioned you had some feedback. Is it still coming?
Comment #24
kyle_mathews commentedYup... just been busy :(
Comment #25
nigelcunningham commentedCool. Me too :)
Comment #26
letapjar commentedI am looking at this too - apparently the og_mailinglist_phpmailer.class.inc
does not work without sendmail - the issue is that if the default mailer is set to Mail then the
Send() function calls parent::sendMail() - but this breaks because the private array DeliverTo is not used by the parent class -
I am working on a work-around for this - something that will call parent::AddBCC and feed the DeliverTo array to the parent so the parent classe's sendMail function will work when Mail() is the mail handler.
Comment #27
letapjar commentedIT WORKS!!!!!
OK I figured out the problem - in og_mailinglist_phpmailer_clas.inc
we use a private array DeliverTo to hold the addresses that should get emailed.
This works find for the sendmail and smtp because this class has it's own methods to handle those two mailers.
but , when the Mailer is set to 'mail' - we rely on the parent class' MailSend' function.
Here's the rub - in our Send() method - we call CreateHeader() but it never checks our DeliverTo array.
So here's the fix:
1) create a function that iterates over the DeliverTo aaray and calls AddBCC for each address in there:
loadBCC() {
foreach ($this->DeliverTo as $to){
$this->AddBCC($to);
}
}
2) in the Send() function - just before the call to CreateHeader() add in a check for the Mailer:
if ($this->Mailer=='mail'){
$this->loadBCC();
}
Bingo - we're in business
when CreateHeader() is called - the BCC array is now populated and thus added to the header - and the list recipients all get the email when the Mailer is 'mail'
I have one random issue in my modified version that still causes a failure message to go to the original sender - but the list recipients are getting the emailed messages and they are posting to the web as well.
I will clean up my code starting from a fresh install from github and submit a patch tomorrow.
Very psyched!!!! this makes Druapl Way better than Google Groups.
Now if we could nail down filefield attachments we're all set.
Comment #28
nigelcunningham commentedHey letapjar - great to see you've got it going.
Did you look at the other thread? I did some work there that you might perhaps find useful too (addresses a couple of other issues, though maybe not as nicely as your version).
Comment #29
kyle_mathews commentedGreat work! I'm excited to see the code and get this committed. I'll give it a go on a shared host I have access to next week and get this stuff committed.
Comment #30
letapjar commentedNigel,
I did use your latest patch as of this morning so I think I'm up to date on that part - couldn't have done it w/o that patch.
Comment #31
nigelcunningham commentedOh... okay. Now I understand what you wrote above - guess I read too quickly the first time :>
I'll look forward to your updated patch. You're right: I didn't provide an updated 'mail' method. If I recall correctly, part of the problem I saw there was that I only wanted it to deliver to the list recipients, not to the original recipients as well. I _think_ you'll find that your email is getting delivered to everyone using the mail method (ie to, cc and bcc) whereas the code I wrote should only deliver to the people in DeliverTo (original recipients won't be sent another copy).
Comment #32
letapjar commentedAhh, I will have to test out this case - right now my testing has only been with two group members and sending replies back and forth - I will have to add a third member and put them in the "to" address - and see if duplicates happen. If they do - it should be easy enough to fix.
Am I understanding correctly that the DeliverTo array has ALL of the people who should be getting the email from the og_mailinglist side?
Comment #33
letapjar commentedOK so from a fresh copy from github I have the code working (still have to test the case Nigel brought up in an earlier post) but here is one problem:
even though the email is sent successfully - the original sender gets an error message from their MTA as follows:
==============================================
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to |/drupal/path/sites/all/modules/og_mailinglist/og_mailinglist_exim4_transport.php
generated by testgroup@groups.mydomain.com
The following text was generated during the delivery attempt:
------ pipe to |/drupal/path/sites/all/modules/og_mailinglist/og_mailinglist_exim4_transport.php
generated by testgroup@groups.mydomain.com ------
X-Powered-By: PHP/5.2.14
Content-type: text/html
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Sun, 31 Oct 2010 15:55:09 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.14
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: store, no-cache, must-revalidate, post-check=0, pre-check=0
Set-Cookie: SESS04d8ee1325756d74c4081e0ecb1f1121=b9f179bb33ce9a1b1e432dca06f71ff3; expires=Tue, 23-Nov-2010 19:28:29 GMT; path=/; domain=.mydomain.com
Last-Modified: Sun, 31 Oct 2010 15:55:09 GMT
Content-Length: 0
Content-Type: text/html; charset=utf-8
------ This is a copy of the message, including all the headers. ------
==============================================================
then the original message is appended below that point.
So question: How do I tell the MTA on my domian that the mail has been successfully processed so that it does not send an error message to the original sender? I saw how Kyle did this in the earlier version where the exim4_router.php script was used - but how do we do this in the current version of the exim4_transport script?
Comment #34
letapjar commentedOK - so when I add a group member into the TO line of the address field - they do not get a duplicate email. i.e. If I belong to the group and you inadvertently also add me to the "To" field of the email that you sedn to the group email address - I only get one copy.
Next test case is if I'm not part of your group but you include me in the TO field - do I get 2 copies?
Nope - the additional recipient only gets one email and it comes from the original sender not from the og_mailinglist module
Sweet!!!! I think this works as intended - just have the error email sent back issue to tack down.
Comment #35
letapjar commentedfound it!
In og_mailinglist_exim4-transport.php
need to use the -q option onthe first line to suppress php header output
next, the curl_opt(Headers, 1) should be set to 0 again to suppress output of headers
and finally - if you have a verbose server like mine
a line has to be added to the php.ini saying: expose_php = off
This will suppress all the extra headers (exim interprets any output other than '0' to be a failure which it then spits back to the original email sender)
Kyle - It looks like I have made a bunch of changes that affect lots of different files - how do you want me to handle all of these?
- changes to exim_4_transport.php to suppress php header output and curl header output
-changes to og_mailinglist_transport.in to eliminate a print_r statement that was unneeded
-changes to og_mailinglist_phpmailer_class.inc to allow the Mail() funcitionality to work note - my solution incorporates the phpmailer patches from : http://drupal.org/node/911974
i'm not too familiar with shared coding - but I know it makes it harder when may issues are bundled into one
there probably also need to be some documentation updates to tell people how this all works
Comment #36
kyle_mathews commentedSince all these changes are related, just keep them together.
The easiest way to get the changes to me so I can review them is to follow this guide:
http://help.github.com/forking/
Once you make the pull request, I'll pull your changes into a branch of my code and test them out and give you any feedback needed. Once we're all satisfied with the changes, I'll merge your changes into the master branch.
A bit more complicated setup (if you're not too familiar with DVCSs already) is to fork my repo, then create a new branch for these changes. Create a new branch for each feature addition / bug fix is a good habit to get into as it makes easier keeping the changes your making separate. Github has really nice support for branching support -- see http://github.com/blog/611-branch-lists for example.
Good work on suppressing the PHP headers stuff. It'd be good to get in as well (though not in this issue) better messages on the POSTing. So if successful, we can print off something like, "The email was successfully POSTed to example.com. If the message does not appear in the appropriate group, check your Drupal logs". In fact, I'll make an issue about that.
Comment #37
letapjar commentedOk here is my patch:
Couple of notes:
This patch actually required Nigel's patch from http://drupal.org/node/911974 to be applied first (I believe) since it relies on the OGPHPMailer class he created.
This patch makes changes to the exim4_transport.php to supress extra php headers and turn off the curl headers so that exim does not send back a failed message to the sender (requried on shared hosts tsince you can't change the configuration of exim)
Also, If PEAR extenstiopns are installed in a custom directory on a shared host - add the custom directory to the php include_path in your settings.php for the domian as follows:
$path = 'path/to.your/pear';
set_include_path(get_include_path().PATH_SEPARATOR.$path);
Next - in your php.ini define the variable: expose_php = off
If this is not done - a header will be added to your curl call and again the email sender gets a failed message even though the message goes through.
In my install I could not figure out how to pass the domain argument to the exim4_transport.php so I had to manually program in the $mail_domain variable - but in this patch I've left that variable the way Kyle had it originally.
The og_mailinglist_utilities.inc had a problem with the mimDecode_load_library fuinction where the regular php include path was not checked - this patch fixes that as well (I submitted a separate patch for just this issue in another thread).
And the og_malinglist.install had a problem where hook_requirements was calling phpmailer_load_library() but the og_ailinglinst_utilities.inc was not included so the status report always failed to find the library - this patch also fixes that issue.
The way I got this to work was to create a subdomain in cPanel (groups.mydomain.com) and then create an account filter where is the incoming email's TO address had groups.mydomain.com then the action to take was to pipe it to /path/to/my/drupal/sites/all/modules/og_mailinglist/exim/og_mailinglist_exim4_transport.php
A side note - on my site , anonymous users cannot access not site content - so in the user permissions for path access I had to add og_mailinglist as a path that anonymous users could access in order for the emails to go through.
Kyle I will create a pull request so you can check all of this out on github.
Comment #38
letapjar commentedforgot to change status
Comment #39
kyle_mathews commentedSetting this as a 1.0 blocking issue.
Comment #41
nigelcunningham commentedWe should put some of letapjar's findings in comment 37 into the INSTALL.txt file.
How about if I also take his/her changes that go on top of my Sendmail replacement patch and incorporate them into it, to simplify things?
Comment #42
letapjar commentedHas anyone else tried this out on a shared host setup?
it has been working beautifully for my groups for a couple of weeks now.
@Nigel, i think the key piece to roll into the other issue was outlined in post #27 above.
Comment #43
kyle_mathews commentedI haven't yet... been busy still...
One question that I can't remember if you've answered before. Did you have to patch PHPMailer to get this running? Or does Nigel's work negate the need for patching?
If you still did need to patch PHPMailer, I'd suggest we (temporarily) fork PHPMailer and stick it on Github. That way we'd have a place to point people at to download our version of PHPMailer + a way to keep track of our changes until the PHPMailer people decide to commit our patch.
Comment #44
letapjar commentedI didn't tough phpmailer myself - but I applied Nigel's patch - so I think the most accurate answer to your questions is yes, this set of changes does require a patch to phpmailer to make some private variables protected so that they can be overridden in the OGmailinglistPHPMailer class.
A github fork for phpmailer is probably a good idea until they can commit our change.
Comment #45
nigelcunningham commentedLetapjar, would you please try what's in my git tree at the moment, with the following patch added (based on #27) and the updated PHPMailer patch from http://drupal.org/node/911974#comment-3748782 ?
If that works correctly, I'll commit it.
Comment #46
letapjar commentedhmm - somehow my patch posted in #37 above missed the changes I had made to this file.
I haven't tested your patch specifically - but it is identical to my patch (except of differences in the name of the function) see the shared_host branch on my git repo at: git://github.com/letapjar/og_mailinglist.git
these changes have been working for me for the past month or so.
I will try to pull in your revised patch from http://drupal.org/node/911974#comment-3748782 and test again perhaps tis weekend - but as far as the changes above - I know they work.
Comment #47
kyle_mathews commentedHey letapjar,
With http://drupal.org/node/911974#comment-3842676, we're almost ready to get this issue solved as well. The biggest thing left here I think is to prepare some solid documentation for the installation process on a shared host as it seems it's somewhat different than when you have root. If you could start writing some documentation, that'd be great. I think screenshots of the different steps would be very helpful as well.
Also, if you could test my changes to make sure they still work with your setup, that'd be appreciated as well.
Comment #48
letapjar commentedI can add some text for the readme. the only problem is that different shared hosts will be different.
Perhaps I can write up directions for cPanel based hosts and some general guidelines for what it takes to make it work.
I have been busy with other projects so I haven't had time to test out nigel's changes.
Comment #49
kyle_mathews commentedYeah, we're not going to get every shared host working right away but as a good percentage do use cPanel, that'd provide a good start.
Comment #50
mrfelton commentedOur setup currently uses Google Apps for email. We have http://drupal.org/project/smtp set up so that mails can be sent using the Gmail SMTP servers (although we do also have Postfix configured for sending mail on our server).
We really dont want to have to set this server up as a full blown mail server, and move the MX records from Google Apps to the server. It strikes me that using http://drupal.org/project/mailhandler in conjunction with this module would be the best way to go. Mailhandler is able to connect to an email account via IMAP (or POP3), and then process the messages in some way. Could that be set up to pipe them to your handling script?
Comment #51
kyle_mathews commentedYeah, mailhandler could definitely be used for grabbing mails. You'd have to write a module to integrate mailhandler w/ ogm so that when mailhandler pulls in new emails directed toward a group, your glue module would then pass them off to ogm.
If you do end up doing something along these lines, that'd be a good addition to ogm as a new submodule.
Comment #52
jun commented+1 to mailhandler config. Created a feature request #1109700: Allow inbound email processing via MailHandler module
Comment #53
Shai commentedWHOA, this is awesome work.
I'd love to test it!
It seems that it didn't get committed. Could someone write up the barest of recipes of what I should download and what patches need to be applied in order for me to test this.
I've got a Cpanel set-up. I'm the root user as well, so I have a lot of flexibility in terms of testing on accounts but could also change configuration outside of accounts, if need be.
Thanks so much to to all the people who worked so hard on this.
I promise to help with documentation.
Shai Gluskin
Comment #54
Shai commented@letapjar,
The patch in #37 does not apply.
I'm getting:
fatal: git diff header lacks filename information when removing 1 leading pathname components (line 24)Can you re-roll or make available your version of the patched module.
I had thought that the latest -dev version of og_mailinglist included that patch, but upon inspection, it does not. I've got it running on a shared host, with the caveats of needing to hardcode the $mail_domain variable and the problem of having exim send out a mail delivery failure when in fact the email does arrive.
Thanks for all your work!
Shai Gluskin
Comment #55
Shai commentedHurray, I got it working. One more user (I may only be the second) who got this module working in a shared hosting environment!
I was never able to get the patch in #37 to apply. What I did instead was make the code changes manually which were recommended for og_mailinglist_exim4-transport.php listed at the beginning of #35.
In addition, in the php.ini file I set
expose_php = Off.Shai
Comment #56
Shai commentedNow that I've got it working, let me highlight something and propose a solution.
Neither @letapjar nor I ever got the $mail_domain variable to be set properly from the piped in email. Presumably that validation is there to prevent spam messages from hitting the list. Since @letapjar and I both had to, essentially, turn off that validation in order to get the module to work, I was wondering how the piping could be made more secure.
Someone who knew a site was using this module and knew the path, "sites/all/modules/og_mailinglist/exim_og_mailinglist/og_mailinglist_exim4_transport AND who had the email address of at least one member of a group, could spam the site by piping emails to that path.
What I've done, until someone suggests something better, is I've added a 20 digit random string to the end of the file name turning og_mailinglist_exim4_transport.php into something like og_mailinglist_exim4_transport_IRcnVD2rBJw7VZHF7Eht.php.
I searched the module and I don't see any code referencing this file, which makes this doable. Now the path that can received piped emails is no longer a publicly known path name.
It's possible this technique might even be worthwhile to do even for the other methods of installing this module. Though it certainly makes upgrading the module entail more steps.
But it seems like it would be pretty easy to spoof a domain name in an email header.
Shai
Comment #57
Shai commentedUpdate,
It's okay to use the initial file name: og_mailinglist_exim4_transport
But you solve the security problem I mentioned by moving that file to the directory above public_html. So on a cPanel server it would be a:
home//og_mailinglist_exim4_transport
That way it isn't available via http and so knowing the file name wouldn't help.
Shai
Comment #58
kyle_mathews commentedI'm setting this issue fixed as the latest release of OG Mailinglist includes a new submodule which integrates with Mailgun's Email API. Mailgun can handle both the sending and receiving of email meaning OG Mailinglist is now quite easy to setup on a shared hosting environment!
Anyone who's working on other solutions for shared hosting environments, please start a new issue and post your code there.
I should also note that the latest release also fixed #911974: Send all emails through PHPMailer removing dependency on having a Sendmail compatible server which was a blocker for getting any sort of solution working on shared hosts.