By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

Extract email-body from IMAP-file

P: n/a
Is it possible to extract the email-body from a IMAP-mail-file ?

The function 'imap_body()' expects that I'm connected to an IMAP-server, but
I'm not. I just have the file.

So I'm looking for a possiblity to use imap_body and give the name of the
file as a parameter.

Thanks in advance.

Regards,

Joachim


Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Joachim Smit <jo*****@onzin.abc> wrote:
Is it possible to extract the email-body from a IMAP-mail-file ?


There is no such tihing as an imap-file. IMAP is a network protocol to
access a mailbox, how the mail is stored is up to the imapd.

The file you have might be in a mbox format, but why don't you describe
the layout?

--

Daniel Tryba

Jul 17 '05 #2

P: n/a
> There is no such tihing as an imap-file. IMAP is a network protocol to
access a mailbox, how the mail is stored is up to the imapd.

The file you have might be in a mbox format, but why don't you describe
the layout?

Well, all the emails are stored as seperate files on the server.

The whole idea is to store the body text of all incoming and outgoing emails
in a PostgreSQL database, together with the relevant information about that
email. (date, time, subject etcetera)

I've made a bash-script to copy the new emails every minute and several
functions in plpgsql to store these emails in the database. That works all
fine. The problem is to translate the qouted-printable bodies into normal
ASCII. I've been working on it for 2 days and I can't manage it to get it
perfect.

In PHP there are several functions who can do the work for me.

Maybe it's a better idea to start all over again and read the new messages
in PHP directly from the IMAP-server and skip the plpgsql-part.

Maybe I should do it as follows:

1. Create e new mail-account
2. Copy all new emails evey minute to the directory of that account
3. Read all new messages from that account with PHP
4. Store 'mail addres from', 'mail address to', 'subject', 'date', 'time'
and 'body text' into the PostgreSQL-database.

What do you think?

Is there a way to read both the text/plain and the text/html part in PHP ?

Thanks.

Regards,

Joachim


Jul 17 '05 #3

P: n/a
> Is there a way to read both the text/plain and the text/html part in PHP ?

It all works fine now.

Regards,

Joachim


Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.