mariom Posted November 10, 2009 Share Posted November 10, 2009 hey guys, I'm writing a script that needs me to run through my inbox and download the relevant attachments from that email. So far I've gotten to see the email attachments using imap_fetchbody, but can't find an good resources to download them. Any ideas? Link to comment https://forums.phpfreaks.com/topic/180926-download-email-attachments/ Share on other sites More sharing options...
mariom Posted November 10, 2009 Author Share Posted November 10, 2009 hey guys, i found the solution. After finding the email, i needed to add this code $mege = imap_fetchbody($mbox,$jk,$fpos); //open mailbox,msg_number,file position $filename="$filename"; //get file name from fetch_imapstructure $fp=fopen($savedirpath.$filename,w); //save file to local directory $data=$this->getdecodevalue($mege,$part->type); fputs($fp,$data); fclose($fp); hope this helps someone Link to comment https://forums.phpfreaks.com/topic/180926-download-email-attachments/#findComment-954543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.