Page 1 of 1

Importing Outlook Express / Thunderbird emails to PHP

Posted: Tue Feb 27, 2007 10:23 am
by impulse()
Has anybody achieved this before or knows of a way to do so? I understand there may be some manual work on the users side but I'm not sure how possible/easy it would be. I thought maybe use fsockopen to connect to a mailserver and retrieve e-mails, but I can see trouble arising.

Regards,

Posted: Tue Feb 27, 2007 10:41 am
by Kieran Huggins
check out the imap functions in php - there are lots of useful nuggets there. Don't be put off by the name, it works with most POP accounts as well.

Posted: Wed Feb 28, 2007 6:13 am
by Chris Corbyn
I still recommend using a system_filter with Exim4 and piping incoming mail directly through a PHP script at SMTP time. It's just a shame hosts don't offer users their own system_filter files. Exim4 does support this, and CPanel runs with Exim4, but it's not configured that way.

I do this quite a lot. We have an incoming mail server at work which I've set up to store mail in a database linked with users in our system. I also used to use this technique to log border-line spam in a DB. I'm also about to write one to keep track of PayPal payments as the emails get sent to me. It's not difficult if you have access to the Exim configuration, or if your host provide user-level Exim configuration.

Posted: Fri Mar 16, 2007 10:05 am
by impulse()
I'm not going to be doing this as originally planned. Now I will be using an e-mail parsing class to parse an uploaded .EML file. Most of this is going well at the moment, I'm able to extract the from, to & subject information from the .EML file but I'm clueless on how to extract the attachment data from the .EML file. Can somebody throw a suggestion at me please.

Regards,

Posted: Fri Mar 16, 2007 10:19 pm
by volka
Depends a little bit on the class you're using.

Posted: Mon Mar 19, 2007 5:25 pm
by impulse()
I'm using a parser class from phpclasses.org named MIME e-mail parser. I have read through the brief documentation that came with the class but it doesn't explain how to parse the attachment. The parser can see the attachment filename but I'm not sure how I would handle the attachment to save it to a location.

Regards,

Posted: Mon Mar 19, 2007 10:48 pm
by mlemos
impulse() wrote:I'm using a parser class from phpclasses.org named MIME e-mail parser. I have read through the brief documentation that came with the class but it doesn't explain how to parse the attachment. The parser can see the attachment filename but I'm not sure how I would handle the attachment to save it to a location.
It seems you have run the example script without changing it. In that case you need to change the parameters array, comment the SkipBody parameter and uncomment the SaveBody parameter setting it to the directory where you want to the message body part files to be saved.

If you leave the SaveBody parameter commented out, the message body parts are returned in the message decoded array as strings. This is not good for large messages as it may exceed the PHP memory limit.

Anyway, for more questions about the MIME parser class, please use the its package specific forum in the PHP Classes site.