I'm trying to send an email with an image taken with the camera from a smartphone. So far, it's going great. I'm sending a post request to my hosted php script from the device, with a Base64 string as post data which represents the picture taken by the user. Although, when I try to mail the image, it doesn't really seem to work out because I get the plain string instead of the image. What's the best technique to solve this and get the image in my mail instead of 2mb ofplain text? ;)
This is my php script:
$to = "secret@gmail.com";
$subject = "New bug report request!";
$pic1 = $_POST["pic1"];
$headers = "From: info@blablabla.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "
<html>
<head>
<title>New bug report request!</title>
</head>
<body>
<h1>New bug report request!</h1>
<hr>
<p>Name: asdfdasf<br>
Email: asdfasdf>
Website URL:asdfasdf<br>
Description: asdfasdf<br>
<img src=\"data:image/png;base64,$pic1\"/>
</p>
</body>
</html>
";
mail($to,$subject,$message,$headers);
At the moment I'm getting something like this:
Maybe I'm using wrong techniques to solve this, any help is welcome :-)