<?php send_email_multi_attachments(); function send_email_multi_attachments() { // array with filenames to be sent as attachment $files = array("/home/www/cb3/ales/echo/b.jpg", "/home/www/cb3/ales/echo/license.htm"); // email fields: to, from, subject, and so on $to = "*****@*****.**"; $from = "*****@*****.**"; $subject = "Echo cartoon"; $message = "My message"; $headers = "From: {$from}"; // boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // multipart boundary $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $message .= "--{$mime_boundary}\n"; // preparing attachments for ($x = 0; $x < count($files); $x++) { $file = fopen($files[$x], "rb"); $data = fread($file, filesize($files[$x])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"{$files[$x]}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$files[$x]}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; $message .= "--{$mime_boundary}\n"; } // send $ok = @mail($to, $subject, $message, $headers);
$report_user .= $form_data['name'] . ": " . get_country($form_field['value']) . "\n"; } else { $report_user .= $form_data['name'] . ": " . $form_field['value'] . "\n"; } } } $report_user .= "\n\r"; $report = $report_user . $report; if ($email != '') { $mess = $report . " <br /><br /> " . $message; //mail($email, 'Подтверждение покупки изображения. Cartoonbank.ru .', $message, $headers); //mail("*****@*****.**", 'Подтверждение покупки изображения. Копия.', $mess, $headers); // Send licenses as attchment send_email_multi_attachments($email, $result_no_license_text); send_email_multi_attachments("*****@*****.**", $result_no_license_text); send_email_multi_attachments("*****@*****.**", $result_no_license_text); $result_no_license_text = null; //mail("*****@*****.**", 'Подтверждение покупки изображения. Копия.', $mess, $headers); } // todo: $_SESSION['nzshpcrt_cart'] = ''; $_SESSION['nzshpcrt_cart'] = array(); $_SESSION['total'] = 0; echo '<div class="wrap">'; if ($sessionid != null) { echo "<h3>Транзакция прошла успешно</h3>"; echo "<br />" . nl2br(str_replace("\$", '\\$', $message_html)); } echo '</div>'; } else { echo '<div class="wrap">';
al_create_cropped_file(200, 200, $imagedir, $ifolder, $slidename, $resample_quality = '100'); // Add logo $export_dir = "/home/www/cb3/ales/echo/"; if (file_exists($export_dir . $slidename)) { wtrmark($export_dir . $slidename, $wm, $author . ' © cartoonbank.ru для echomsk.spb.ru'); } //send email //email content $_link = "http://cartoonbank.ru/?page_id=29&brand=" . $brand; $_link_cartoon = "http://cartoonbank.ru/?page_id=29&cartoonid=" . $ID; $content = "Автор: " . $author . "\n\r"; $content .= "Название: " . $title . "\n\r"; //$content .= $_link_cartoon."\n\r"; $content .= "Cсылка на страницу с карикатурой: " . $_link_cartoon . "\n\r"; // send email to Echo with image and license attachment send_email_multi_attachments($content); //payment for Echo pay_on_behalf_of_echo($image_id); notify_artist($purchase_id); mysql_close($link); ?> <?php function wtrmark($sourcefile, $watermarkfile, $text) { $logopath = "/home/www/cb3/img/cb-logo-300.png"; $logofile_id = imagecreatefrompng($logopath); imageAlphaBlending($logofile_id, true); imageSaveAlpha($logofile_id, true); $fileType = strtolower(substr($sourcefile, strlen($sourcefile) - 3));