Good morning, The problem I have is with a code to send emails with attachments that I found on the web and I want to modify it to send a variable, however when placing the variable it does not arrive in the mail, and verify that the variable is not empty so I guess it will be my mistake or something I do not know yet.
$id=$_GET['id'];
//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 = '[email protected]';
$subject = 'Subasta slip';
$message = strip_tags($_POST['message']);
$attachment =
chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$filename = $_FILES['file']['name'];
$boundary =md5(date('r', time()));
$headers = "From: [email protected]\r\nReply-To: [email protected]";
$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
//********************aquí es donde quiero enviar la variable****************
<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);
As a side note, I can use any way to send the variable, I just need to see it somewhere. Thanks in advance