Welcome Guest, Not a member yet? Register   Sign In
Sending Emails with inline images[solved]
#1

[eluser]Clooner[/eluser]
I extended the email class to support inline images. I updated the attach function of the class like so
Code:
function attach($filename, $disposition = 'attachment', $content_id = '')
{
$this->_attach_name[] = $filename;
$this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename))));
$this->_attach_disp[] = $disposition; // Can also be 'inline'  Not sure if it matters
if ($content_id == '')
    $content_id = basename($filename);
$this->_attach_coid[] = $content_id;
}

and I updated the following code of the build_message function.
Code:
$h .= "name=\"".$basename."\"".$this->newline;
$h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline;
and added the content-id line
Code:
$h .= "name=\"".$basename."\"".$this->newline;
$h .= "Content-ID: <".$this->_attach_coid[$i].">".$this->newline;
$h .= "Content-Disposition: ".$this->_attach_disp[$i].";".$this->newline;

this works really well in most major webmail clients and desktop clients except thunderbird. I already tried to change the charset and encoding as well as redefine how cr and newlines are done. I tried a lot already but basically I don't know where to look for the problem and thus don't know what to fix.

I was hoping someone could point me in the right direction for getting the inline images to work correctly.
#2

[eluser]Clooner[/eluser]
I found the solution of showing inline messages in all mail clients by switching the content-type from multipart/mixed to multipart/related.

I updated the my_email class which now overrules the $multipart variable in the email class
Code:
var $multipart    = 'related';




Theme © iAndrew 2016 - Forum software by © MyBB