Firefox PHP

Module: External Phorummail

Posted by Thomas Seifert 
Module: External Phorummail
August 31, 2009 06:28PM
This module allows importing emails from external mail accounts through POP3, IMAP with SSL (requires the OpenSSL php extension to be installed).

Together with the Mailing List Module this allows for two way integration with mailinglists.

Version 2.x because its mostly a rewrite the of the old POP3Phorummail module with another mail parser- and connection library (EZ Components, included in the module, no PEAR libs are needed), additional support for IMAP and mail attachments. Additionally it fixes an issue when multiple phorums are bound to one maillist and the phorums would miss each others messages.

Quote
README
Requirements:
-------------
- PHP5 install with at least mysql/mysqli, iconv, SPL - which are usually bundled with PHP by default
- Phorum-5.2.x install (tested only on 5.2.13)
- shell / cronjob access to setup a scheduled task to run this module,
raw shell access is only needed during testing

Quote
README
Installation instructions:
--------------------------

- Unpack the archive;

- Move the directory "ext_phorummail" to the directory "mods"
within your Phorum installation;

- Login as administrator in Phorum's administrative interface and
go to the "Modules" section;

- Enable the module "External Phorummail".

- Go to the settings page of the External Phorummail module to configure from which
mailservers and to which phorums it should import mail.

- Setup a cronjob to run scheduled tasks
for example like this (would run the tasks every 5 minutes):
*/5 * * * * cd /home/your/phorum/directory && /usr/bin/php ./script.php --scheduled > /dev/null

I recommend to run the script by hand until everything is working correctly, e.g with this command-line
cd /home/your/phorum/directory && /usr/bin/php ./script.php --scheduled

Example install ServerPhorums.com.

2011-03-22 v2.1.5 Robert Angle
	- add an option to moderate all incoming messages by marking them as unapproved messages.
	

2010-10-10 v2.1.4
    - fix for missing / at the end of tmpDir in some environments
    - some refactoring to avoid duplicated code 

2010-09-17 v2.1.3
    - fixed ssl option (again), made password field a real password field
    - set tmp path for the parser to phorum cache directory (to avoid always using /tmp)
    - fixed access check for moderated forums
    
2010-07-11 v2.1.2
    - fixed importing relatedPart-Mails (e.g. from Incredimail) 
    - fixed empty attachment names which seem to occure in similar cases
    - upgraded ezComponents to 2009.2.1 which seems to be the last release 
      before the rename to Zeta Components

2010-06-03 v2.1.1 - Robert Angle
	- now prevents registered but inactive members from posting via email.

2010-06-01 v2.1.0 - Robert Angle
	- added an option to deny emails from non-registered users.
	- added an option to enable the after_post hook.

2009-09-04 v2.0.6
    - bugfix for lost message subject (bug introduced in 2.0.5) 

2009-09-04 v2.0.5
    - added search for html parts in case no text/plain part is found
    
    - fixed handling of "related Multipart" messages in case there is no body found
      (thanks to Jim Ohlstein for the report) 

2009-09-04 v2.0.4
    - fixed handling of "related Multipart" messages

2009-09-04 v2.0.3
    - added automatic charset conversion in case a different charset is set in the default

2009-09-03 v2.0.2
    - added an option to specify the maximum message size to import 
    
2009-09-01 v2.0.1
    - fixed a bug in the error case so that an error message is really sent out.

2009-08-31 v2.0.0

    - Initial release of the rewritten version based on EZ Components and with additional IMAP Support.
      renamed to External Phorummail as its not only POP3-based anymore.

2008-10-12  v1.0.0

    - Initial release of the original POP3Phorummail


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting




Edited 12 time(s). Last edit at 03/28/2011 09:21PM by Thomas Seifert.
Attachments:
open | download - ext_phorummail-2.1.5.tar.gz (159.7 KB)
open | download - ext_phorummail-2.1.5.zip (258.5 KB)
Re: Module: External Phorummail
September 02, 2009 04:31AM
Quote
Requirements:
- Phorum-5.2.x install (tested only on 5.2.13), with UTF-8 (which it has by default) Charset

Hi Thomas,

Does this mean I could never use this module, since my database default is 'latin1' because the UTF-8 in the config.php didn't come about till later?

- Bob
Re: Module: External Phorummail
September 02, 2009 06:51AM
Correct, unless your Phorum is converted to UTF-8. Note however that this comes with some problems and is not a really easy task to perform.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: External Phorummail
September 02, 2009 01:11PM
Correct and I have no way to change this in the library used. It does the conversion to utf8 by default and has no setting to change this.
I already plan to bring it back to the developers of the lib, maybe a switch is added later.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: External Phorummail
September 04, 2009 11:41AM
The new version 2.0.3 should do automatic charset conversion if needed.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: External Phorummail
September 04, 2009 01:31PM
And another update to 2.0.4 for handling multipart related messages.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: External Phorummail
September 04, 2009 05:16PM
Quote
Thomas Seifert
And another update to 2.0.4 for handling multipart related messages.

Hi Thomas,

I am getting errors with multipart messages:

These options need to match
 in Unknown on line 0
PHP Notice:  Undefined index:  name in /path/to//mods/ext_phorummail/ext_phorummail.php on line 170
PHP Fatal error:  Call to undefined method ezcMailMultipartRelated::getParts() in /path/to/mods/ext_phorummail/ext_phorummail.php on line 258

I'm not worried about the notice but the fatal error is obviously the issue. I noticed it when there were two multipart messages in the inbox. For the moment I have commented out lines 256-268:

Language: PHP
  1. // if we found no text/plain part, use the first part
  2. // This should be rare, but you can never tell.
  3. if(empty($new_message["body"])){
  4.  
  5. $msgparts = $message->body->getParts();
  6. $firstpart = current($msgparts);
  7.  
  8. $new_message["body"]=$firstpart->text;
  9.  
  10. // give it shot to see if it is HTML
  11. if($firstpart->subType=="html"){
  12. $new_message["body"]=strip_tags($new_message["body"]);
  13. }
  14.  
  15. }

The problem is that now those two multipart messages came out blank.

PHP is 5.2.10 (CLI).

Jim

Nginx Forum
Re: Module: External Phorummail
September 04, 2009 05:42PM
Good to know that there's someone else using that code too :).

Well, that part is a last resort for messages having no text/plain part after all. So they might have ended up empty anyway.
I added a search for html bodies if no text/plain bodies were found and fixed this call.

Try the fresh 2.0.5 release.
Thanks for the report.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: External Phorummail
September 04, 2009 06:13PM
actually there was a new bug introduced in 2.0.5 so please use 2.0.6.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: External Phorummail
September 04, 2009 06:44PM
I was using the previous mod that you gave me a great of help getting to work properly.

Some advantages of this new mod include recognizing non-English characters when the email is encoded using "ISO-8859-1" and some other non "utf-8" charsets, which was giving us some troubles. It also recognizes Chinese characters in "Sender" field which had been in an issue. They were coming out as blank. We have a good number of users from China as nginx is very popular there. Unfortunately, many of those users seem to send HTML only mail so I hope this works.

I'll do some tests with those emails and let you know.

Jim

Nginx Forum
Sorry, only registered users may post in this forum.

Click here to login