If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Help With Calling A Function

Hi guys! I found this script doing a google search for extracting attachments from emails using php and imap. It seems to be working just fine as far as logging in and I can even extract an attachment from a single email but I need to be able to extract several attachments from more than one email and then save them to my site. Something like this added to the script:

PHP Code:

foreach ($content as $data)
{ file_put_contents($filename, $data); }

I know that's not the correct syntax but hopefully you understabd what I mean. Here's the script below:

I finally figured out why I'm getting that error after putting that code inside an if statemant, but I still don't know how to fix it so it works.

If called from within a function, the return() statement immediately ends execution of the current function, and returns its argument as the value of the function call. return() will also end the execution of an eval() statement or script file.

Can somebody show me how to fix that script so that it can be put inside an if statement so I can use it with a form. I would greatly appreciate it.