The encoding flag returned by imap2_fetchstructure is wrong for encoded images. It is returning zero when the image is in fact base 64 encoded. Ref: line #133 of BodyStructure.php Please fix this asap. Thanks.