Nico Edtinger
2007-06-25 19:31:17 UTC
Hi Luiz!
Yes, Zend_Mail_Message and Zend_Mail_Part is used to get messages and
its parts from local or remote mail storages and split them into
parts. They also implement RecursiveIterator so you could use a
simple foreach loop (maybe with RecursiveIteratorIterator) to get the
parts.
Currently the whole message is fetched, because I didn't manage to
finish partial fetch for 1.0. I'm planning to fetch the content and
headers of the parts on-demand for IMAP with the next ZF version.
What I've also planned is a method to copy the content of a message
or part to a given stream. The idea is something like:
<?php
$message = ...; // fetch message
// copy message content to file
$fh = fopen('mymessage.txt', 'w');
$message->copyContent($fh);
fclose($fh);
// output attachment for download
$fh = fopen('php://output', 'w');
$message->getPart(1)->copyContent($fh);
fclose($fh);
?>
It's coming, but it needs some time to be done (the stream copy
should be done in protocol level, to avoid using much memory). I'm
sorry I couldn't finish it earlier.
nico
Yes, Zend_Mail_Message and Zend_Mail_Part is used to get messages and
its parts from local or remote mail storages and split them into
parts. They also implement RecursiveIterator so you could use a
simple foreach loop (maybe with RecursiveIteratorIterator) to get the
parts.
Currently the whole message is fetched, because I didn't manage to
finish partial fetch for 1.0. I'm planning to fetch the content and
headers of the parts on-demand for IMAP with the next ZF version.
What I've also planned is a method to copy the content of a message
or part to a given stream. The idea is something like:
<?php
$message = ...; // fetch message
// copy message content to file
$fh = fopen('mymessage.txt', 'w');
$message->copyContent($fh);
fclose($fh);
// output attachment for download
$fh = fopen('php://output', 'w');
$message->getPart(1)->copyContent($fh);
fclose($fh);
?>
It's coming, but it needs some time to be done (the stream copy
should be done in protocol level, to avoid using much memory). I'm
sorry I couldn't finish it earlier.
nico
Hello,
I have a mail application where I need to work with incoming mail
attachments and I want to port it to Zend Framework.
I have read in the manual about isMultipart() and getPart() methods
of Zend_Mail_Part and I suppose that's the way to go unless the
manual is
outdated. The email storage I'm using is a remote IMAP server.
How does Zend_Mail deal with the parts? Do I need to read data into a
variable and then save it to the disk or is there a way to transfer
the
remote data directly to the filesystem? My concern is about large
attachments.
Could you give me some insight about it?
Thank you!
Luiz
I have a mail application where I need to work with incoming mail
attachments and I want to port it to Zend Framework.
I have read in the manual about isMultipart() and getPart() methods
of Zend_Mail_Part and I suppose that's the way to go unless the
manual is
outdated. The email storage I'm using is a remote IMAP server.
How does Zend_Mail deal with the parts? Do I need to read data into a
variable and then save it to the disk or is there a way to transfer
the
remote data directly to the filesystem? My concern is about large
attachments.
Could you give me some insight about it?
Thank you!
Luiz