![Picture of Michael Hosford Picture of Michael Hosford](/picture/user/816549.jpg)
Michael Hosford - 2010-11-01 02:43:25
Hi,
When I auto-attached an image to be embedded in an HTML email, it got MIME-typed as 'application/octet-stream'. The email still displayed properly, but I noticed that the Spamassassin spam score was higher than it should be because of the mis-typed image.
Around line 546 of dSendMail2.inc.php (at the beginning of the _getAutoMimeType() function), is the line:
$ext = strtolower(substr($filename, -3));
The problems with using substr() to grab the last 3 characters of the filename is that (1) not all of the extensions are 3 chars long, and (2) all of the comparison strings in the case statement include the '.', so most of them are 4 chars long. The following correction works for extensions of any length, and fixes the problem:
$ext = strtolower(strrchr($filename,'.'));
Thanks--
Michael Hosford