Yii Framework Forum: mail fetching and MIME e-mail handling - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

mail fetching and MIME e-mail handling Rate Topic: -----

#1 User is offline   mindplay 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 397
  • Joined: 03-September 09
  • Location:New York

Posted 24 September 2009 - 04:07 PM

This week, I had a client who needed a webbased e-mail client as part of a bigger solution.

My first thought was to leverage an existing webmail client, but it turns out they are all licensed under GPL, and hence would not allow us to do the tight integration required for this proprietary software project.

I looked around for e-mail client libraries, but found nothing really complete or up to date.

So we started down the hard path of developing from scratch, using the IMAP extension for PHP, which turns out to be pretty handy, though not very well documented. And despite it's name, it does not only IMAP, but also POP3, and supports SSL. Very nice.

About 10 hours into the actual work, I had a pair of classes that would connect to a POP3 or IMAP server, and let me list and iterate through the messages on the server. At which point, one of our Ruby/Rails developers came in and told us, hey, I can do that in a couple of hours - I was a bit baffled, but sure enough, with about three hours of work, he had not only e-mail fetching, but also a MIME parser up and a running.

With Rails, you simply write a handler for incoming e-mail, and it can decode MIME attachments for you and everything, so all you have to do is decide what you want to do with the content and implement that. Super easy.

I would have liked to stay in PHP for this project, but it appears that none of the PHP frameworks offer anything similar to this. Looking at various open-source webmail clients, they all seem to implement their own (extremely complex) MIME handling systems to cover all of the differences in e-mail from various exotic clients and servers.

This is kind of frustrating.

How come Ruby and Rails people get this functionality right out of the box, and the rest of us have to work like dogs to support mail fetching and MIME handling?

I would love to see Yii offering generic e-mail features. This sort of stuff should not need to be this complicated - it's the kind of stuff you'd like to see implemented once, and done right, rather than trying to reinvent the wheel for every project.

I never got as far as to decode MIME attachments - the IMAP extension takes care of fetching attachments, but doesn't seem to help with attachment decoding. From looking at various webmail client codebases, is extremely complicated, often some 5-10k lines of code, to handle every kind of message properly, including all the proprietary crap that comes out of Microsoft and Apple products.

I would be happy to do some cleanup and documentation of my e-mail fetching classes, if there's any interest.

But I'm afraid that's baby steps towards a framework with a full MIME message handling stack.

Love to hear any of your thoughts or ideas on this topic, as well as pointers if I missed some library out there?
1

#2 User is offline   jogasa21 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 09-March 11
  • Location:Costa Rica / Cambodia

Posted 19 September 2011 - 03:03 AM

Oohhh man !
It is nice to see that I am not the only one who crashes front-to-front with this problem. Right now I am dealing with the same situation that you already had, developing a email client and adding some other functions to integrate with other existing applications for a non-profit organization.
I didn't find anything really useful nor understandable/easily maintainable open source email client with MIME capabilities for an IMAP server.

Did you finally build / found something nice to manage IMAP mail?

TIA.
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 19 September 2011 - 03:13 AM

They are GPL licensed for a reason: pay them for a commercial license if you need one.
"Less noise - more signal"
0

#4 User is offline   SapporoGuy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 177
  • Joined: 25-December 10
  • Location:Sappor Beer Refinery

Posted 07 April 2012 - 04:03 PM

Old topic but has anyone ever over come this problem?

Currently reading up on:
Ezcomponet, zend mail, eticket, osticket And flourish

Strange that ruby almost getsbthis out pf the box and php is left to fend for it's own :(
0

#5 User is offline   Ivica 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 317
  • Joined: 25-May 11

Posted 17 April 2012 - 12:46 AM

Please note that PHP native imap function are based on old IMAP2 protocol, so for example, you can not search messaged by date and time(you can only by date), you can search by UID(for example get all messages that have UID higher then 1234). So consider those limitation carefully before you choose to use PHP imap functions.

Zend_Mail also have very limited options, you are even not able to use search options(in specifications there is notice that search function is only for internal use, so like this feature is not completed).

Last option is Horde_Imap, which is very complex library, without any tutorial how to use it.
Zurmo: Yii Powered Open Source CRM
zurmo.org
0

#6 User is offline   pannet1 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 02-June 10

Posted 08 August 2014 - 10:21 AM

lvica,
what a wonderful work you guys did with Zurmo. I cannot believe you did it. By the way do you have done a a library to give email notification of mails fetched from external server.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users