Link to home
Start Free TrialLog in
Avatar of purpleonyx
purpleonyx

asked on

PHP script to read e-mail attachment after POP3 login

So many questions asked about how to upload/attach a file to PHP's mailer process, sure no problem there.

Here's something on a different level I am trying to do.

1: PHP script that checks a specific e-mail account (via POP3)

2: After reading all of the data, I need PHP to read/import any file attachments based on an extension filter (ONLY import if they are *.gif, *.jpg, etc)

3: Save attachment to a folder (create if necessary) based on the sender's email address.


Most of this I have the answer for.  A bit unclear on making a POP3 connection with PHP, but am sure I can figure that out... But how would I go about step 2, actually importing the body of the message, and grabbing any attachments?  I need to accomodate both inline HTML images, and actual attachments.
ASKER CERTIFIED SOLUTION
Avatar of jdpipe
jdpipe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of purpleonyx
purpleonyx

ASKER

Thanks JP, got everything working how I wanted it to.  I found all of the IMAP_* commands to use, and just parsed the remainder out, for plain-text and image/*.  Got it to auto create directories based on email address and save the attachments to that newly created directory.

As for the forward script, the problem is the mail server (Qmail) is on a separate machine, and it does not want to use dot-forward to send to another machine unless there is some sort of directory sharing, which I don't want.  Feel free to correct me if my understanding of how this works is incorrect.

Much appreciated!
You're welcome. Sounds like you've come up with a good solution
JP