PHP Mail client library - php

I know there is plenty of PHP mail libraries out there, but most of them are designed to send emails, is there any library that will help me fetch emails from imap/pop3 accounts, deal with attachments etc?
I'm already using imap_* functions from PHP IMAP extension but using it is problematic, as I have to re-invent the wheel in most cases (ie. parsing the result of imap_fetchstructure to get to attachments)
Mayby there is any ready to use lib build on top of imap_* or similar, that will help me deal with fetching mails, without re-writing all that logic behind well known problems?

I have missed the obvious Zend_Mail will do the trick

Here is a PHP Pop3 Client that I use for a script on my server.
http://www.phpclasses.org/package/2-PHP-Access-to-e-mail-mailboxes-using-the-POP3-protocol.html
You could easily use that to create a graphical layout, but I have not had the necessity for it.

Related

Implementing IMAP server

I need to write an IMAP wrapper around some messaging system.
With all the complexity of IMAP protocol i'd rather use some existing library to do the heavy lifting for me.
Are there any IMAP servers / libraries / frameworks available in PHP or Python?
Alternatively, is there such IMAP server which would allow to write a driver to use custom messaging system as a backend?
If you do not mind using Java then, Apache James IMAP provides RFC2040 compliant data access layer for IMAP. It is not fully optimized for performance yet but appears to be tested and in working condition otherwise. They also provide a full IMAP server and because everything is under Apache license, you should be able to use it as is or modify it any way you feel like.
The Python library for writing protocol servers and clients with probably the best reputation is Twisted. It contains an implementation of an IMAP server (twisted.mail.imap4.IMAP4Server). From a quick glance, it seems you'd need to wrap your "mail boxes" in this interface.
(Note though that I never used this class and I'm not sure if this really works as I expect it to work.)

POP3 email to MySQL database? What options do I have?

Ok..... basically what I'm trying to do is setup something that will handle all incoming mail on a certain POP3 email address, pass all the relevant data to a PHP script, which will then parse the data & insert it into a MySQL database.
Now I have been looking around a bit..... checked out procmail, but that just confused the hell outta me (I'm not much of a server guy, just know enough CL stuff to get by), so was wondering if there were any better options available to me or any existing PHP classes that made it a bit easier?
Thanks a lot - any help would be much appreciated!
Sounds like you have two tasks before you:
Write a PHP script that checks the POP3 account, processing any mail it finds.--You could use PHP's IMAP functionality, which supports IMAP, POP3 and NNTP.
Somehow get the above-mentioned script to run when new mail is received.--An easy way to simulate this effect would be to use a cron task to run your script regularly...perhaps every few minutes. Hopefully, your web host supports cron tasks--you may find an option to set them up in your hosting account's control panel or you may need to contact support for assistance.
Hope this helps,
Ben
There are some classes built to help you out as well:
http://www.phpclasses.org/package/2-PHP-Access-to-e-mail-mailboxes-using-the-POP3-protocol.html
As weird as it may sound, check out the imap extension of PHP. It supports POP3 and is fairly easy to use.

How to use HTML with Function (mail) for send info Coordinated?

How to use HTML with Function "mail" for send info Coordinated ?
I believe you may be asking how to send HTML mail using PHP's mail() function.
While you can do so and there's even an example on the manual page, you shouldn't. You have to manage all the MIME bits yourself, and set the correct headers, and that's a bit of a pain.
Instead, grab a third-party library that does all the dirty work for you, like PHPMailer or PEAR Mail or Zend Mail. They're all pure-PHP and licensed so that you can simply bundle them with your application without having to get them installed by the sysadmin.

php class to handle and parse the courier mail server format

does anyone know if there's a class out there that parses courier mailboxes (ie: courier imap mail server)? returning lists, and parsing individual messages?
this is not a protocol issue, i'm not interested in connecting to a remote mail-server. rather, i'm interested in manipulating the local mail-server via filesystem.
In particular, the mails are kept in files, but those do not contain the "from" email address, i am completely puzzled by this and more issues. Does anybody have any experience with this?
Maybe the Zend_Mail component of Zend Framework might help, here ?
(If it's like several other components of ZF, it might be do-able to "extract" it from the framework, to use it as some standalone component)
Quoting a portion of this page : Reading Mail Messages :
Zend_Mail can read mail messages from
several local or remote mail storages.
And there is table of features :
Feature Mbox Maildir Pop3 IMAP
Storage type local local remote remote
Fetch message Yes Yes Yes Yes
Fetch MIME-part emulated emulated emulated emulated
Folders Yes Yes No Yes
Create message/folder No todo No todo
Flags No Yes No Yes
Quota No Yes No No
So it seems Zend_Mail is able to do at least some manipulations on "local" mail -- including reading them (Not sure whether Courrier uses Mbox or Maildir, but as both are supported...).
after some searching, this class: http://www.phpclasses.org/browse/package/3169.html#download does a pretty decent job at parsing the raw mail message, thank you guys for helping out.

PHP Mail Client

I have a need to read the 'body' of the most recent email received using PHP (not interested in sender, etc...), but I am not at all sure how to do this. The mail server uses IMAP
http://ryerson.ca/ccs/email/rmail/clients/ConfiguringMozillaThunderbird.pdf <--Uses the same server described here. (This is not for my personal mail, its to read data and post it to a website. I would rather not use email to acheive this, but I do not have a choice here.)
Any idea how to do this? Code Examples? Anything is appreciated
The PHP IMAP Extension should provide you with what you need, assuming you have it or have the ability to install it.

Categories