Skip to content

Instantly share code, notes, and snippets.


Created Nov 13, 2017
What would you like to do?
//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 = '';
$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:\r\nReply-To:";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
$message="This is a multi-part message in MIME format.
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
<h2>ID del producto</h2><p> $id </p> $message
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
mail($to, $subject, $message, $headers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment