Send dynamically div image to client mail : <p>i am using html2canvas with barcode to make a dynamically image to specific div with the below function </p>

<pre><code>$(function() { 
    $("#btnSave").click(function() { 
html2canvas($('#printableArea'), {
   onrendered: function(canvas) {
     var img = canvas.toDataURL()
     window.open(img);
}
                });
            });
        });
</code></pre>

<p>The image opens into new winodw in base64
My problem is that i want to send the image to client mail for printing.
The image changes for each client accordingly and is specific </p>

<p>my php file is </p>

<pre><code>&lt;?php
include("auth.php");
//message
$message = $_POST['msg'];
$username =$_REQUEST['username'];
$surname =$_REQUEST['surname'];
$name= $_REQUEST['name'];
//mail body - image position, background, font color, font size...

$body = "Dear $surname  $name
Thank you for your Pre-registration for Global.
Please print the attached e-ticket with your personal barcode and bring it to the reception of the exhibition.
This barcode includes data about you which is required during registration. Having this barcode will considerably speed up the registration process
Organizing committee.\n".



$body = "Print e-ticket
(http://panosmoustis.netai.net/barcodeimage/E-ticket_2016.pdf) .\n".

$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n";
$headers .= 'From: &lt;http://panosmoustis.netai.net/&gt;' . "\r\n";
$to = $_POST['mail'];
$subject = "EXPRESS REGISTRATION (Global)";
//mail function
$email = mail($to, $subject, $body, $headers);
if(!$email) { 
echo "Error sending email"; 
} else {
echo "Your email was sent successfully.";
}
?&gt;
</code></pre>

<p>thank you</p>
