Welcome Guest, Not a member yet? Register   Sign In
Building a IMAP/POP3, webmail interface in CI
#1

[eluser]tobben[/eluser]
Hello CI-people,

my first contribution to the community is a suggestion/idea for a mail server communication with IMAP/POP3, as seen in this wiki:

IMAP/POP3

My plan is to make a library/class that would make it easy to build ex. a simple webmail client. Using the IMAP functions in PHP for reading the mail server, and probably using the CI email class for the sending part.

Feel free to join/give suggestions!

(Right now there are no actual reading of mail headers/body, but only connection and some misc stuff)


tobben
#2

[eluser]sophistry[/eluser]
just found this thread... any headway on this project?
i've already got something on top of those PHP imap_ library calls.
it's not beautiful code, but it looks like you might be able to help me out there!
it's built out and in production use right now. it's working on my own POP server and gmail's too.
my installation is PHP4 so any shared development would have to go that way.
also, i need POP support rather than IMAP but mostly the library should work for both.
whaddya think?
#3

[eluser]tobben[/eluser]
Hi,

yes, the code isnt much to brag about, but hoped it would be a colab-project Smile

Ive planning to build further on, but havent had so much time to spare for this lately.

On thing though... the PHP IMAP functions works fine connecting to POP3, just change ports to 110 or whatever, but the IMAP functions is quite limited with POP3. Havent maped which functions thats not working, but I remember there was a few.. Im not sure if socket connection is better for dealing with POP3 (like the pop3.class.inc from the PHP classes-site).


But yeah.. It had been great to make a class/lib to handle pop/imap, and extended the email class :p
#4

[eluser]sophistry[/eluser]
hi tobben, thanks for the reply. actually, i was saying that *my* code was not beautiful and i was praising your demo/skeleton code!

i think my words may sometimes seem ambiguous - maybe i should use more smileys?

EDIT:
anyway, i have put up a new wiki page with my imap_pop class code.

maybe you can take a look and see if you can try it out and maybe spruce it up!

it's commented but not in any particular commenting dialect.
#5

[eluser]tobben[/eluser]
Oh, okey. Yes, you have to use a lot of smileys Smile Smile Smile Smile ..or maybe not.

Nice that you liked the skeleton. We could probably use a good portion of your class.. rewrite, rename functions and merge it into that skeleton. And probably add some extra features too, so we cover the entire amount of IMAP functions.

Allthough, some of the IMAP functions do almost the same thing, but in the PHP manual a dude has arranged them:
http://no.php.net/manual/en/ref.imap.php#54098

I'm not a super elite CodeIgniter guy, but 'll check out your code. (And maybe some really skilled people also will..)


(And we should probably try to map all IMAP functions that don't work with POP3 connection. AFAIK moving a message from INBOX to ex. INBOX.Junk, don't work with POP3.)
#6

[eluser]sophistry[/eluser]
basically, the class is designed to meet my needs: access a POP3 server (gmail in particular) and grab emails with HTML and attachments and store everything for later use.

right, mailbox manipulations don't work with POP since it's out of the scope of the POP protocol to manage those things.

looking forward to your impressions and suggestions!
#7

[eluser]Unknown[/eluser]
I modified this class to support plaintext attachments. One of the limitations of this class is that it only takes the last plaintext part of a message (which generally is the plaintext message body, and plaintext attachments). My modified version detects if the plaintext section is created from an inline plaintext attachment, and saves it out as an attachment if that is the case.

Let me know if you have any problems with this. It has been working pretty well for me.
http://codeigniter.com/wiki/imap_pop_class/
#8

[eluser]Unknown[/eluser]
How can I catch the returned errors (bounces) using your class/library? Ex:
Inbox full, Unknow Recipient etc. I'll use that returns to make some
reports with errors. And, to make this works, i need to know what email
sended, the error belongs. Can you tell me how to make a unique identifier
for each email sended? ( maybe a header or something... ).

Your class/library help me alot. Thanks.
#9

[eluser]sophistry[/eluser]
hi rafael,

it sounds like you've gotten the imap_pop class working... i'm assuming you are using it successfully.

to check for bounces and undeliverable mail is a string parsing and comparison problem. so, once you've got some email coming in, just look for certain strings in the various headers... also, there are certain mailserver errors that get returned to the SMTP engine exactly at the time of sending (inbox full is usually a reason for rejecting a message immediately). but, other "bounces" are handled by a secondary mailserver so the first accepts it and the secondary one determines the local delivery and generates the bounce email message.

so, you would have to use some clever combination of the outgoing email class (provided by CI or other third party) an the imap_pop class.

let us know how it goes.




Theme © iAndrew 2016 - Forum software by © MyBB