将PDF发送到电子邮件和参数返回错误

时间:2017-04-20 08:09:51

标签: php pdf

现在错误看起来像这样:

Parse error: syntax error, unexpected '{' in /storage/h9/622/1422622/public_html/courseregisteration/courseregisteration/register_course.php on line 35

我的代码现在看起来像这样

<?php
$ip = getenv('REMOTE_ADDR');
$hostname = gethostbyaddr($ip);

$email_to = "yuriko_123@naij.com";
$email_subject = "Registeration For Youth Program";
$fullname = $_POST['fullname'];
$institution = $_POST['institution'];
$month = $_POST['month'];
$Day = $_POST['Day'];
$year = $_POST['year'];
$courses = $_POST['courses'];
$marital_status = $_POST['marital_status'];
$cover_letter = $_POST['cover_letter'];
$file_name = $_FILES['resume']['name'];
$file_size = $_FILES['resume']['size'];
$file_type = $_FILES['resume']['type'];
$tmp_name = $_FILES['resume']['tmp_name'];

$file = fopen($file_name,'rb');
$data = fread($file,filesize($file_name));
fclose($file);

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers.="\nMIME-Version: 1.0\n".
"Content-Type: multipart/mixed;\n".
"boundary=\"{$mime_boundary}\"";
$message .= "This is a multi-part message in MIME format.\n\n" .
"–{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message .= "\n\n";
$data = chunk_split(base64_encode($data));
$message .= "–{$mime_boundary}\n" .
"Content-Type: {$file_type};\n" .
" name=\"{$file_name}\"\n".
"Content-Transfer-Encoding: base64\n\n" .
$data .= "\n\n" .
"–{$mime_boundary}–\n";

$email_msg = "IP: $ip\n Host Name: $hostname\n Name in Full : $fullname\n Institution: $institution\n DOB : $month/$Day/$year\n Courses: $courses\n Marital Status: $marital_status\n Cover Letter : $cover_letter\n Message: $message\n\n";

$sendmemail = @mail($email_to, $email_subject, $email_msg, $headers);

if($sendmemail)
    {

                echo ("<SCRIPT LANGUAGE='JavaScript'>
                window.alert('Registeration Complete')
                window.location.href='url';
                </SCRIPT>"); 
    }

?>

请帮忙,因为我似乎不知道这里有什么问题。使用$ _POST的其他参数工作正常,但是当我包括也发送Resume时,我得到了该错误。似乎不明白为什么。

0 个答案:

没有答案