0

I am using jQuery and PHP in order to send a form as an email. Inside the form is an image upload. I want to include this image inside my email. I know that there are a lot of examples though every example is uploading the image to the FTP and then sends it as an email. I want to send it directly without saving it somewhere...

This is what I currently have:

<form id="myform" method="post">
    <input id="Telefon" name="Telefon" type="text"></input>
    <input id="Email" name="Email" type="text"></input>
    ...
    <input id="fileupload" type="file" name="img" accept="image/*" multiple>
</form>

jQuery:

$.post( "action.php", $('#myform').serialize(),function( data ) {
  // bla bla 
});

PHP:

$Email = $_POST['Email'];
$Telefon = $_POST['Telefon'];

How can I access the image?

$receiver = "blabla@blabla.de";
$subject = "Bla Bla";
$from = "From: {$Name} {$SurName} <blabla@blabla.de>";
$text = "This is my message
         Telefon: {$Telefon}
         Email : {$Email}"

mail($receiver, $subject, $text, $from);

Everything works fine but how can I include my photo?

Tom el Safadi
  • 6,164
  • 5
  • 49
  • 102

1 Answers1

0

What I'd suggest is uploading it to a third party image site and sending the link as an image. This way you avoid uploading directly to your ftp and makes it easier for any email service to pull the image.