- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
function send_attach(
$to, //!< Email получателя
$from, //!< Email отправителя
$task, //!< Тема письма
$text //!< Текст письма
) {
$boundary = "--".md5(uniqid(time())); // генерируем разделитель
$subject= $task." [".stripslashes($_SERVER['HTTP_HOST'])."]";
$subject ='=?windows-1251?B?'.base64_encode($subject).'?=';
$headers = "To: ".$to."\r\n";
$headers="From: =?windows-1251?B?".base64_encode(stripslashes($_SERVER['HTTP_HOST']))."?= <".$from.">\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\""
.$boundary."\"\r\n";
$headers .= "--".$boundary."\r\n";
$headers .= "Content-type: text/html; charset=windows-1251 \r\n";
$headers.="Subject: ".$subject."\r\n";
$headers.="X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "Content-Transfer-Encoding: Quot-Printed\r\n\r\n";
$headers .= '<html><head><title>Заявка с сайта</title></head>';
$headers .= '<body>'.$text.'</body></html>';
//.'<img src=\'24.jpg\' alt="img">
$message_part = "";
if(
isset($_FILES['f_file']['tmp_name']) and
is_array($_FILES['f_file']['tmp_name'])
) {
foreach($_FILES['f_file']['name'] as $k => $v) {
if (trim($v) != '') {
$fname = $_FILES['f_file']['tmp_name'][$k];
$fp = fopen($fname,"r");
$file = fread($fp, $_FILES['f_file']['size'][$k]);
fclose($fp);
$message_part .= "--$boundary\r\n";
$message_part .= "Content-Type: application/octet-stream\r\n";
$message_part .= "Content-Transfer-Encoding: base64\r\n";
$message_part .= "Content-Disposition: attachment; filename = \""
.$_FILES['f_file']['name'][$k]."\"\r\n\r\n";
$message_part .= chunk_split(base64_encode($file))."\r\n";
}
}
}
$message_part .= "--".$boundary."--\n";
return mail($to, $subject, $message_part, $headers);
}
Функция отправки письма с сайта. Технически - вроде работает. А так, вполне себе "обфускация" получилась.
Vasiliy 16.10.2012 15:59 # +1
scriptin 16.10.2012 20:03 # +1
niggerzilla 19.10.2012 15:16 # +1
А 8битные символы в номинально 7битном потоке?
guest 19.10.2012 18:59 # +1
eth0 16.10.2012 18:50 # 0