The reason why you are having problems is because the SugarPHPMailer.php file is hardcoded to treat every image as an attachment. This class can be found in /include/SugarPHPMailer.php . It is an extension of PHPMailer class. Here is the cause of the problem:
Code:
$this->AddAttachment($file_location, $filename, 'base64', $mime_type)
Every image is marked as an attachment, and is not marked as an
inline attachment.
To display the image as embedded in the email, a different function
AddEmbeddedImage is required. I have made a work around. All my images which need to be embedded, I use a suffix of 'inline'. Eg instead of 'Logo.jpg' I use 'logo_inline.jpg'.
Then Add a couple of lines to SugarPHPMailer.php:
Code:
$filename = substr($filename, 36, strlen($filename)); // strip GUID for PHPMailer class to name outbound file
if (strpos($filename,'inline')) {
$this->AddEmbeddedImage($file_location,$filename,$filename,'base64',$mime_type);
}else{
$this->AddAttachment($file_location, $filename, 'base64', $mime_type);
} I have only tried this with version 5,0, However the class used is based on PHPMailer, so it should work.
I'm not sure why it has been written like this, Have Fun
http://www.jsimmons.co.uk
Bookmarks