确实需要帮助! 我在提交时创建了一个html表格,然后发送电子邮件。 我的问题是,在收到的电子邮件中, attachment看起来是细致的,但电文是空白的,没有出现。 什么是不正确的? 这是我下面的《加拿大刑法》。
<?php
//get data from form
$name= $_POST[ name ];
$email= $_POST[ email ];
$jobrole= $_POST[ jobrole ];
$portfoliowebsite = $_POST[ portfoliowebsite ];
$address= $_POST[ address ];
$city= $_POST[ city ];
$tel= $_POST[ phone ];
$fileName = $_FILES[ upload ][ tmp_name ];
$filenameee = $_FILES[ upload ][ name ];
$date= $_POST[ date ];
$msg= $_POST[ coverletter ];
$message ="Name: ". $name . "
Email: " . $email . "
Job Applied For: " . $jobrole . "
Portfolio Website: " . $portfoliowebsite . "
Contact Address: " . $address . "
City: " . $city . "
Phone: " . $tel . "
Date: " . $date . "
Coverletter: " . $msg;
$subject = "Job Application";
$fromname ="Goldengroup";
$fromemail = [email protected] ; //if u dont have an email create one on your cpanel
$mailto = "[email protected]";
$content = file_get_contents($fileName);
$content = chunk_split(base64_encode($content));
// a random hash will be necessary to send mixed content
$separator = md5(time());
// carriage return type (RFC)
$eol = "
";
// main header (multipart mandatory)
$headers = "From: ".$fromname." <".$fromemail.">" . $eol;
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-Type: multipart/mixed; boundary="" . $separator . """ . $eol;
$headers .= "Content-Transfer-Encoding: 7bit" . $eol;
$headers .= "This is a MIME encoded message." . $eol;
// message
$body = "--" . $separator . $eol;
$body .= "Content-Type: text/plain; charset="iso-8859-1"" . $eol;
$body .= "Content-Transfer-Encoding: 8bit" . $eol;
$body .= $message . $eol;
// attachment
$body .= "--" . $separator . $eol;
$body .= "Content-Type: application/octet-stream; name="" . $filenameee . """ . $eol;
$body .= "Content-Transfer-Encoding: base64" . $eol;
$body .= "Content-Disposition: attachment; filename="" . $filenameee.""" . $eol . $eol; "size=" . filesize ($uploadedFile) ."";
$body .= $content . $eol;
$body .= "--" . $separator . "--";
if($email!=NULL){
mail($mailto, $subject, $body, $headers);
}
//redirect
header("Location:thankyou.html");
?>
我曾尝试过上述法典,查封工作罚款,但收到电子邮件时没有出现电文。