English 中文(简体)
html表格中的数据和电子邮件信息,在收到行政电子邮件后不出现,但附文似乎并作罚款
原标题:Data & email message from html form not appearing after received in admin email, but attachment appears and works fine

确实需要帮助! 我在提交时创建了一个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");

?>

我曾尝试过上述法典,查封工作罚款,但收到电子邮件时没有出现电文。

问题回答
  1. 你在贵方的某处失踪了约美元。

  2. 请适当阅读档案内容,如使用

    
    $file3 = $fileName;
    $file_size3 = filesize($file3);
    $handle3 = fopen($file3, "r");
    $content3 = fread($handle3, $file_size3);
    fclose($handle3);
    $content = chunk_split(base64_encode($content3));

  1. This line is redundant (the one after Content-Type: multipart/mixed;), so let s remove / remark it
$headers .= "Content-Transfer-Encoding: 7bit" . 
  1. Better use md5(uniqid(time())); instead of md5(time()); as separa纽约总部r

因此,请修改以下部分:

    $content = file_get_contents($fileName);
    $content = chunk_split(base64_encode($content));
    // a random hash will be necessary 纽约总部 send mixed content
    $separa纽约总部r = md5(time());
    // carriage return type (RFC)
    $eol = "
";
    // main header (multipart manda纽约总部ry)
    $headers = "From: ".$fromname." <".$fromemail.">" . $eol;
    $headers .= "MIME-Version: 1.0" . $eol;
    $headers .= "Content-Type: multipart/mixed; boundary="" . $separa纽约总部r . """ . $eol;
    $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
    $headers .= "This is a MIME encoded message." . $eol;
    
    
    // message
    $body = "--" . $separa纽约总部r . $eol;
    $body .= "Content-Type: text/plain; charset="iso-8859-1"" . $eol;
    $body .= "Content-Transfer-Encoding: 8bit" . $eol;
    $body .= $message . $eol;
    
    // attachment
    $body .= "--" . $separa纽约总部r . $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 .= "--" . $separa纽约总部r . "--";

   
   if($email!=NULL){
    mail($mail纽约总部, $subject, $body, $headers);
}


?>


纽约总部

   
    $file3 = $fileName;
    $file_size3 = filesize($file3);
    $handle3 = fopen($file3, "r");
    $content3 = fread($handle3, $file_size3);
    fclose($handle3);
    $content = chunk_split(base64_encode($content3));

//  $separa纽约总部r = md5(time());
    $separa纽约总部r = md5(uniqid(time()));

    // carriage return type (RFC)
    $eol = "
";
    // main header (multipart manda纽约总部ry)
    $headers = "From: ".$fromname." <".$fromemail.">" . $eol;
    $headers .= "MIME-Version: 1.0" . $eol;
    $headers .= "Content-Type: multipart/mixed;" . $eol . " boundary="" . $separa纽约总部r . """ ;
  //  $headers .= "Content-Transfer-Encoding: 7bit" . $eol;
    $headers .= "This is a MIME encoded message." . $eol. $eol;
    
    // message
    $body = "--" . $separa纽约总部r . $eol;
    $body .= "Content-Type: text/plain; charset="iso-8859-1"" . $eol;
    $body .= "Content-Transfer-Encoding: 8bit" . $eol. $eol;
    $body .= $message . $eol;
    
    // attachment
    $body .= "--" . $separa纽约总部r . $eol;
    $body .= "Content-Type: application/octet-stream;". $eol . " name="" . $filenameee . """ . $eol;
    $body .= "Content-Transfer-Encoding: base64" . $eol;
    $body .= "Content-Disposition: attachment;". $eol . " filename="" . $filenameee.""" . $eol . $eol ; 
    $body .= $content . $eol;
    $body .= "--" . $separa纽约总部r . "--";
   
    mail($mail纽约总部, $subject, $body, $headers);

?>




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签