📄 send.php
字号:
<html>
<head>
<title>Send image</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#C0C0CA">
<p align="center">
<?php
if (isset($_POST['filename'])) {
$filename = $_POST['filename'];
$charset = "iso-8859-1";
$from = quoted_printable_decode($_POST['from']);
$to = quoted_printable_decode($_POST['to']);
$subject = quoted_printable_decode($_POST['subject']);
$message = quoted_printable_decode($_POST['message']);
// create mail header
$boundary = "next_part_87df57es69a1q40z";
$header = "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/mixed;\n\tboundary=$boundary\n";
$header .= "From: $from\n";
// create mail body
$body = "\nThis is a multi-part message in MIME format.\n";
// message part
$body .= "\n--".$boundary;
$body .="\nContent-Type: ".$_POST['image_type']."; name=\"$filename\"".
"\nContent-Transfer-Encoding: base64\n\n";
$fp = fopen($filename,"rb");
$binary_data = fread($fp,filesize($filename));
$image = chunk_split(base64_encode($binary_data));
fclose($fp);
$body .= $image;
// image part of the message
$body .= "\n--$boundary";
$body .= "\nContent-Type: text/plain; charset=$charset";
$body .= "\nContent-Transfer-Encoding: 8bit\n\n";
$body .= $message;
// end of multi-part message
$body .="\n--$boundary--\n";
if ($subject != "")
$subject = "=?$charset?B?".base64_encode($subject)."?=";
// send mail
if (mail($to,$subject,$body,$header)) {
echo "<h4>Your picture and message are sent successfully.</h4>\n";
echo "<p><a href=\"edit.htm\">Go back to editing</a></p>";
}
else
echo "<h3>Error while sending e-mail. Please, try again</h3>\n";
}
else
echo "filename is undefined";
?>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -