Closed tolgacinar closed 2 years ago
I've had the same issue. You need to base64_decode the attachment body. I've changed the line of file_put_contents[...] in ImapClient\SaveAttachments method to this:
This solved the problem for me: _file_put_contents($dir.DIRECTORY_SEPARATOR.$newFileName, base64decode($attachment->body));
thanks, why not pulled?!?!
@YaWK @ggiacomoo It's a good solution, but not for each attachment. Some of attachments need quoted_printable_decode.
if (base64_decode($attachment->body, true) == true){
file_put_contents($dir.$newFileName, base64_decode($attachment->body););
}else{
file_put_contents($dir.$newFileName, quoted_printable_decode($attachment->body));
}
Save attachments with this function but cant open files. Files are breaking