첨부 파일이있는 전자 메일을 보내는 PHP 코드가 있지만 원하는 것은 이름, 연락처 번호 등의 모든 데이터를 테이블에 넣는 것입니다. <table>
을 사용해 보았지만 전자 메일은 여전히 일반 텍스트입니다. 누군가 그것을 만드는 방법을 도와 줄 수 있습니까?html 형식의 첨부 파일이있는 전자 메일 보내기
이 내 PHP 코드 : PHP 복잡한 이메일 용
<?php
$cname = $_POST['Name'];
$cnumber = $_POST['Tel'];
$cemail = $_POST['emailadd'];
$cmess = $_POST['contactmess'];
$index = 'index.php';
move_uploaded_file($_FILES["attachment"]["tmp_name"] , "/files/upload/" . $_FILES["attachment"]["name"]);
$to = '[email protected]';
$subject = 'Careers Inquiry';
$random_hash = md5(date('r', time()));
$headers = "From: ". $cemail ."\r\nReply-To:". $cemail;
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$headers .= "Content-Type: text/html; charset='iso-8859-1'";
$attachment = chunk_split(base64_encode(file_get_contents("/files/upload/" .$_FILES["attachment"]["name"])));
ob_start();
?>
--PHP-mixed-`<?php echo $random_hash; ?> `
Content-Type: multipart/alternative; boundary="PHP-alt-`<?php echo $random_hash; ?>`"
--PHP-alt-`<?php echo $random_hash; ?>`
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
--PHP-alt-`<?php echo $random_hash; ?>`
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<html>
<body>
<table>
<tr><td>Name: </td><td><?php echo $cname; ?></td></tr>
<tr><td>Contact Number: </td><td><?php echo $cnumber; ?></td></tr>
<tr><td>Email Address: </td><td><?php echo $cemail; ?></td></tr>
<tr><td>Message: </td><td><?php echo $cmess; ?></td></tr>
</table>
</body>
</html>
--PHP-alt-`<?php echo $random_hash; ?>`--
--PHP-mixed-`<?php echo $random_hash; ?>`
Content-Type: application/octet-stream; name="`<?php echo $_FILES["attachment"]["name"];?>`"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
`<?php echo $attachment; ?>`
--PHP-mixed-`<?php echo $random_hash; ?>`--
<?php
$message = ob_get_clean();
$mail_sent = @mail($to, $subject, $message, $headers);
unlink('/files/upload/' . $_FILES["attachment"]["name"]);
echo $mail_sent ? header('Location: '. $index): '<script type="text/javascript"> alert("Sorry, service temporary unavailable."); </script>';
?>
[바퀴를 다시 만들지 마십시오] (https://github.com/Synchro/PHPMailer). –