Re: IMAP and Attachments
| From: | Jome | Date: | Tue, 24 Jul 2001 09:50:35 +0000 |
| Subject: | Re: IMAP and Attachments | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59318@lists.php.net to get a copy of this message | ||
> How can I check to see if a email has an attachment? Then download it if the
> user clicks on it?
I've been working on a webmail for POP3 but I guess the idea is about the same.
To check if a an email has attachments you use the function imap_fetchstructure() and then you can
do something like this:
$struc = imap_fetchstructure();
count($struc->parts);
if ($no_of_parts > 0) {
echo "the message has attachments.";
}
This is my way of doing it, the 'bad' thing with this kind of code is that it also
includes HTML-messages. This can be prevented with some extra code though.
For downloading you use the same kind of thing, I guess it slightly more advanced and you have to do
some decoding of the message.
Best regards,
Jome
(looking for php-jobs, coding for $15/hour)