Я пытаюсь отправить электронное письмо с вложением, используя функцию php mail (). Письмо отправлено правильно с вложением, но содержимое html (тело почты) не отображается в моем письме. он показывает только файл вложения.
<?php $htmlbody=" <strong>Name:</strong> {$_POST['name']}<br> <strong>Position:</strong> {$_POST['position']}<br> <strong>Email:</strong> {$_POST['email']}<br> <strong>Phone:</strong> {$_POST['phone']}<br> <strong>Date Of Birth:</strong> {$_POST['dob']}<br> <strong>Qualification:</strong> {$_POST['qual']}<br> <strong>Experiance:</strong> {$_POST['experiance']}<br> <strong>Remarks:</strong> {$_POST['remarks']}"; $strSid = md5(date('r', time())); $strHeader = ""; $strHeader .= "From: {$_POST['email']}\nReply-To: {$_POST['email']}\n"; $strHeader .= "MIME-Version: 1.0\n"; $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n"; $strHeader .= "This is a multi-part message in MIME format.\n"; $strHeader .= "--".$strSid."\n"; $strHeader .= "Content-type: text/html; charset=utf-8\n"; $strHeader .= "Content-Transfer-Encoding: 7bit\n"; $strHeader .= "Content: ".$htmlbody."\n"; //*** Attachment ***// if(isset($_FILES['resume'])){ $filename = $_FILES['resume']['name']; $ext = pathinfo($filename,PATHINFO_EXTENSION); if(!in_array($ext,array('doc','docx'))){ die('Invalid File'); } move_uploaded_file($_FILES['resume']['tmp_name'],"temp/$filename"); $strContent = chunk_split(base64_encode(file_get_contents("temp/$filename"))); $strHeader .= "--".$strSid."\n"; $strHeader .= "Content-Type: application/octet-stream; name=\"".$filename."\"\n"; $strHeader .= "Content-Transfer-Encoding: base64\n"; $strHeader .= "Content-Disposition: attachment; filename=\"".$filename."\"\n"; } $to = "name@domain.com"; $subject = "Test email with attachment"; $mail = mail($to, $subject, $htmlbody, $strHeader); echo $mail ? "Mail sent" : "Mail failed"; ?>