alexgv14 0 Light Poster
<?php

	$jpg = $GLOBALS['HTTP_RAW_POST_DATA'];
	$img = 'MyPicture.jpg';
	$to = $_GET['email'];
	//header("Content-type: image/jpeg");
	//header("Content-Disposition: attachment; filename=".$img);
	//echo $jpg;
	$FromEmail = 'wcww@gmail.com';
	$FromName = 'We Can Waste Wise';
	$msg = 'We hope you will come play again!';
	$subject =	 'Your Recyclable Art!!';


$To          = strip_tags($to);
$HTMLMessage ='';
$Subject     =strip_tags($subject);

$boundary1   =rand(0,9)."-"
.rand(10000000000,9999999999)."-"
.rand(10000000000,9999999999)."=:"
.rand(10000,99999);
$boundary2   =rand(0,9)."-".rand(10000000000,9999999999)."-"
.rand(10000000000,9999999999)."=:"
.rand(10000,99999);

 

     
$attach      ='yes';
$end         ='';

  // $handle      =fopen($_FILES['fileatt']['tmp_name'][$i], 'rb'); 
  // $f_contents  =fread($handle, $_FILES['fileatt']['size'][$i]); 
  // $attachment[]=chunk_split(base64_encode($f_contents));
   $attachment = chunk_split(base64_encode($jpg));
   //fclose($handle); 



/***************************************************************
 2- HTML Email WIth Multiple Attachment <<----- Attachment ------
 ***************************************************************/

$Headers     =<<<AKAM
From: $FromName <$FromEmail>
Reply-To: $FromEmail
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="$boundary1"
AKAM;


$attachments=<<<ATTA
--$boundary1
Content-Type: image/jpeg;
    name="$img"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename="$img"

$attachment

ATTA;


$Body        =<<<AKAM
This is a multi-part message in MIME format.

--$boundary1
Content-Type: multipart/alternative;
    boundary="$boundary2"

--$boundary2
Content-Type: text/plain;
    charset="windows-1256"
Content-Transfer-Encoding: quoted-printable

$TextMessage
--$boundary2
Content-Type: text/html;
    charset="windows-1256"
Content-Transfer-Encoding: quoted-printable

$HTMLMessage

--$boundary2--

$attachments
--$boundary1--
AKAM;


/***************************************************************
 Sending Email
 ***************************************************************/
if(mail($To, $Subject, $Body, $Headers)){
     echo 'true'; 
} else { 
     echo 'false'; 
}

?>

I have this code above which works fine. basically what it does is it sends images as attachments. But when i receive emails in outlook I got this MIME error and I have no idea how to fix it. Anybody knows why?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.