$emailboundary = md5(time()); // Just something random for the boundary
$emailboundary = '----=Email_Boundary_'.$emailboundary; // Full boundary
if(!empty($imagedata['mime']) && !empty($imagedata['name']) && !empty($imagedata['data']))
{
$emailheaders .= "\nDate: " . gmdate('D, d M Y H:i:s') . " -0000\nX-Mailer: Lazarus Guestbook\nMIME-Version: 1.0\nContent-type: multipart/mixed;\n boundary=\"".$emailboundary."\"";
$emailbody = "\n\nThis is a multi-part message in MIME format.\nIf you are reading this then consider updating your email program.\n\n--".$emailboundary."\nContent-type: multipart/alternative;\n boundary=\"".$emailboundary."Laz\"\n\n".
'--'.$emailboundary."Laz\nContent-type: text/plain; charset=".$this->VARS['charset']."; format=flowed\nContent-Transfer-Encoding: 7bit\nContent-Disposition: inline\n\n".
$this->undo_htmlspecialchars(strip_tags($emailmessage)).
"\n\n--".$emailboundary."Laz\nContent-type: text/html; charset=".$this->VARS['charset']."\nContent-Transfer-Encoding: 7bit\nContent-Disposition: inline\n\n".
"\n
\n
\n".
$emailmessage.
"\n\n\n\n--".$emailboundary.
"Laz--\n\n--".$emailboundary."\nContent-type: ".$imagedata['mime']."; name=\"".$imagedata['name']."\"\n".
"Content-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"".$imagedata['name']."\"\n\n".$imagedata['data'].
"--".$emailboundary."--\n";;