Skip to content

Instantly share code, notes, and snippets.

Created November 13, 2017 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/faa4844b22854a8576d4c668eebbca52 to your computer and use it in GitHub Desktop.
Save anonymous/faa4844b22854a8576d4c668eebbca52 to your computer and use it in GitHub Desktop.
<?php
//The form has been submitted, prep a nice thank you message
$output = '<h1>!</h1>';
//Set the form flag to no display (cheap way!)
$flags = 'style="display:none;"';
//Deal with the email
$to = 'ganadores@XXX.com';
$subject = 'Subasta slip';
/* TEST: A partir de aquí sobrescrito variables para probar de manera más comoda */
//$message = strip_tags($_POST['message']);
$message = strip_tags('Aquí iría el POST'); //Borra
//$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$attachment = 'Aquí el atachment'; //Borra
//$filename = $_FILES['file']['name'];
$filename = 'Aquí el fileName'; //Borra
/* Creo variable ID, ya que no aparece en el código */
$id = 'TEST';
/* FIN TEST */
$boundary =md5(date('r', time()));
$headers = "From: cliente@XXX.com\r\nReply-To: cliente@XXX.com";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
$message="This is a multi-part message in MIME format.
--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
--_2_$boundary
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
<h2>ID del producto</h2><p> $id </p> $message
--_2_$boundary--
--_1_$boundary
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--_1_$boundary--";
mail($to, $subject, $message, $headers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment