hey i think i got a solution
0){
for($i = 0; $i < $no_of_occurences; $i++){
$strChange = strval($intStatic+$i);
$decode = imap_fetchbody($mbox, $msgno , $strChange);//to get the base64 encoded string for the image
$data = base64_decode($decode);
$fName = time()."_".$strChange . '.gif';
$file = $fName;
$success = file_put_contents($file, $data); //creates the physical image
}
}
imap_close($inbox);
?>