function performDBBackup() { $path = '/var/www/html/APPS/territory-api/database/backups/'; $filename = 'db-backup-' . date('m-d-Y', time()) . '.sql'; $output = array(); $return_var = -1; $dbn = getEnvConf('DB_DATABASE'); $dbu = getEnvConf('DB_USERNAME'); $dbp = getEnvConf('DB_PASSWORD'); $command = 'mysqldump --user='******' --password='******' --host=localhost ' . $dbn . ' > ' . $path . $filename . ' --skip-add-drop-table '; $last_line = exec($command, $output, $return_var); // var_dump($command); if ($return_var === 0) { // success echo 'success: '; mail_attachment($filename, $path, $mailto = '*****@*****.**', $from_mail = '*****@*****.**', $from_name = 'Territory Api', $replyto = '*****@*****.**', $subject = 'Territory Api Database Backup', $message = 'Database backup for ' . date('m-d-Y', time())); } else { // fail or other exceptions echo 'failed: '; var_dump($output); } }
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $content = trim(curl_exec($ch)); curl_close($ch); unset($ch); echo $content; } */ /* $array = array(403251,405995,405997,407438,407439,410202,413289,416645,416646,418212,418688,419607,419952,420580,421628,428098,428099,428479,428626,428627,434990,436372,436390,436394,436395,436520,437379,442426,445084,450504,450506,450900,451840,455390,456407,457036,457262,457474,457500,457704,459185,459186,459187,459188,459190,459191,459192,459193,459194,459195,459196,459197,459198,459199,461134,461155,461715,461749,461940,462409,462491,462851,463787,464558,464958,464978,466256,466257,467741,467742,468556,468557,468949,468957,469353,469645,469646,470589,471864,471865,474851,477035,478006,478007,480414,480475,485903,485905,485920,486409,486410,486461,486536,486541,486575,486586,486602,488983,488994,490247,493826,493826,483851,434301,470924); foreach( $array as $value ) { $query = "INSERT INTO visa_coupon (visa_code) VALUES ($value)"; //$query = "UPDATE core_config_data SET value = '{{unsecure_base_url}}js/' WHERE path = 'web/unsecure/base_js_url'"; $writeConnection->query($query); //mysql_query( $sql, $conn ); } */ $date = date('Y-m-d', time() - 24 * 60 * 60); $my_file = "credit_orders.csv"; $my_path = "/home2/html/zofya/public_html/uniware/"; $my_name = "Zoffio System"; $my_mail = "*****@*****.**"; $my_replyto = "*****@*****.**"; $my_subject = "Customer Report With Company Name (Exclude Credit Users) - " . $date; $my_message = "Hi Dev,\r\nPlease Find the attachment for " . $date . " Customer orders with Company name and without Credit users last 30 days Report."; mail_attachment($my_file, $my_path, "dev.mohanty@zoffio.com,arun.prabhu@zoffio.com,suparno.mojumder@zoffio.com", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
$header .= "--" . $uid . "\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message . "\r\n\r\n"; $header .= "--" . $uid . "\r\n"; $header .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n"; $header .= $content . "\r\n\r\n"; $header .= "--" . $uid . "--"; if (mail($mailto, $subject, " ", $header)) { echo "mail send ... OK"; // or use booleans here } else { echo "mail send ... ERROR!"; echo $mailto . '<br/><br/>'; echo $subject . '<br/><br/>'; echo $header . '<br/><br/>'; } } $my_file = "cuteImage.jpg"; $my_path = $_SERVER['DOCUMENT_ROOT'] . "/nutterMailer/"; echo $my_path; $my_name = "Olaf Lederer"; $my_mail = "*****@*****.**"; $my_replyto = "*****@*****.**"; $my_subject = "This is a mail with attachment."; $my_message = "Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf"; mail_attachment($my_file, $my_path, "*****@*****.**", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
<?php if ($_POST["project"] == "") { $headers = "From: " . $_POST["name"] . " <" . $_POST["email"] . ">\r\n" . 'Reply-To: ' . $_POST["email"]; if (mail("*****@*****.**", $_POST["subject"] . " (" . $_POST["version"] . ")", $_POST["text"], $headers)) { echo "true"; } else { echo "false"; } } else { if (mail_attachment($_POST["project"], "*****@*****.**", $_POST["email"], $_POST["name"], $_POST["subject"] . " (" . $_POST["version"] . ")", $_POST["text"])) { echo "true"; } else { echo "false"; } } function mail_attachment($filecontent, $mailto, $from_mail, $from_name, $subject, $message) { $filename = "project.caal"; $content_attachment = chunk_split(base64_encode(json_encode($filecontent))); $uid = md5(uniqid(time())); $type = "text/plain"; $header = "From: " . $from_name . " <" . $from_mail . ">\n"; $header .= "Reply-To: " . $from_mail . "\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\n"; $content = "\n--" . $uid . "\n"; $content .= "Content-Type:text/plain; charset=iso-8859-1\n"; $content .= "Content-Transfer-Encoding: 7bit\n\n"; $content .= $message . "\n"; $content .= "\n--" . $uid . "\n";
/*$header = 'From: '.$from_mail. "\r\n"; $header .= 'Bcc: '.$bcc. "\r\n"; $header .= 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if(@mail($mailto,$subject,$message,$header)){ echo "mail send ... OK"; } else { echo "mail send ... ERROR!"; } echo "Nabagopal"; die;*/ //@mail_attachment($file,$path,$to,$from,$from_name,$replyto,$subject,$message); @mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message,$cc="",$bcc); /* ================== Mail send to Members =====================*/ $flag=2; } function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message,$cc="",$bcc="") { //echo "HHHHHHHH".$from_name."<br/>"; //echo $bcc; die(); /*$file = $path.$filename; $file_size = filesize($file); //echo $file."HHH".$file_size; die; $handle = fopen($file, "r");
$q = "Select Max(id) as id From cards ;"; $r = mysql_query($q); while ($vname = mysql_fetch_array($r)) { $id = $vname['id']; } //$id=18; //echo ($abc); echo $id; //exec("java -jar C:\wamp\www\VCCC\\EPSProject.jar \""+$abc+"\"" , $output); //exec("java -jar C:\wamp\www\VCCC\\EPSIMAGE.jar $id", $output ); exec("java -jar epsAKalender.jar {$id}", $output); //forserver // //print_r($output); $ini = parse_ini_file('config.ini', false); mail_attachment($emailField, $ini["clientEmail"], "Ihr Adventskalender Anfrage", $tempmessage, "*****@*****.**", "EPSIMAGE/Front_EPS_" . $id . ".pdf"); //print_r($output); } function mail_attachment($to, $clientEmail, $subject, $message, $from, $file) { $mail = new PHPMailer(); // defaults to using php "mail()" $mail->IsSendmail(); // telling the class to use SendMail transport $mail->SetFrom($from, ''); $mail->AddAddress($to, ""); $mail->AddBCC($clientEmail, ''); $mail->Subject = $subject; $body = $message; //$mail->AltBody = $message; // optional, comment out and test $mail->MsgHTML($body);
header("Location: {$errorurl}"); exit; } else { // captcha correct, show a new one next time unset($_SESSION['num1'], $_SESSION['num2']); } // Send Message $message = "This message was sent from:\n" . "{$http_referrer}<br />" . "Name: {$name}<br />" . "Phone Number: {$phn_no}<br />" . "Email: {$email}<br />" . "Subject: {$subject}<br />" . "Comments: {$comments}<br />" . "<br />------------------------------------------------------------<br />"; $total_size = array_sum($_FILES["upload"]["size"]); if (count($_FILES["upload"]["tmp_name"]) > 0 && isset($_FILES["upload"]["tmp_name"][0]) && trim($_FILES["upload"]["tmp_name"][0]) != '') { if ($total_size <= 10485760) { for ($i = 0; $i < count($_FILES["upload"]["tmp_name"]); $i++) { move_uploaded_file($_FILES["upload"]["tmp_name"][$i], 'tmp/' . basename($_FILES['upload']['name'][$i])); } //move_uploaded_file($_FILES["upload"]["tmp_name"],'temp/'.basename($_FILES['upload']['name'])); mail_attachment($from, $mailto, $subject, $message); echo "<script type=text/javascript>window.location='/thank-you.html'</script>"; } else { header("Location: {$errorurl}"); exit; } } else { $headers = "From: " . $from . "\r\n"; $headers .= "Reply-To: " . $from . "\r\n"; $headers .= "Return-Path: " . $from . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-Mailer: PHP" . phpversion() . "\r\n"; if (mail($mailto, $from, $message, $headers)) { // echo "<script type=text/javascript>alert('Thank you for your feedback')</script>";
function func_rep_dep_tomail($contract, $month, $year, $traffic_table) { $tel_number = "\n SELECT DISTINCT {$traffic_table}.number \n FROM {$traffic_table}\n WHERE {$traffic_table}.number IN \n (\n SELECT DISTINCT {$traffic_table}.number \n FROM {$traffic_table},department,phone \n WHERE {$traffic_table}.number=phone.number \n AND phone.contract LIKE '%{$contract}'\n )\n\t\tORDER BY {$traffic_table}.number\n "; $result_tel_number = mysql_query($tel_number); $num1 = mysql_num_rows($result_tel_number); //Получаем название лицевого счета $query_dep = "\n SELECT DISTINCT dep \n FROM department,phone,{$traffic_table} \n WHERE department.contract LIKE '%{$contract}'"; $result_dep = mysql_query($query_dep); $result_dep = mysql_fetch_array($result_dep); $result_dep = $result_dep[0]; echo '<h3><br/>Отчет за - ' . $_GET['month'] . '.' . $_GET['year'] . ' год(а).<br/>Лицевой счет - ' . $result_dep . ' (' . $contract . ')<br/></h3>'; //Получаем лимиты $query_limits = "SELECT DISTINCT limit_all,limit_AMTS,mail \n FROM department \n WHERE contract LIKE '%{$contract}'"; $result_limits = mysql_query($query_limits); $result_limits = mysql_fetch_array($result_limits); $limit_all = $result_limits['limit_all']; $limit_AMTS = $result_limits['limit_AMTS']; $mail = $result_limits['mail']; if ($num1 > 0) { $csv_file .= "Номер;Все затраты,руб.;Трафик Локальный,руб.;Трафик Зоновый,руб.;Трафик Межгород,руб.;Остальные затраты,руб.;\r\n"; if (ob_get_level() == 0) { ob_start(); } for ($i = 0; $i < $num1; $i++) { $row1 = mysql_fetch_array($result_tel_number); $query_cost_local = "\n SELECT SUM(traffic_cost) as cost_local\n FROM " . $traffic_table . "\n WHERE traff_local != '0'\n AND " . $traffic_table . ".number IN (\n SELECT " . $traffic_table . ".number \n FROM " . $traffic_table . ",phone \n WHERE " . $traffic_table . ".number = '" . $row1['number'] . "' \n AND phone.contract LIKE '%{$contract}')\n ;"; $query_cost_zone = "\n SELECT SUM(traffic_cost) as cost_zone\n FROM " . $traffic_table . "\n WHERE traff_zone != '0'\n AND " . $traffic_table . ".number IN (\n SELECT " . $traffic_table . ".number \n FROM " . $traffic_table . ",phone \n WHERE " . $traffic_table . ".number = '" . $row1['number'] . "' \n AND phone.contract LIKE '%{$contract}')\n ;"; $query_cost_amts = "\n SELECT SUM(traffic_cost) as cost_amts\n FROM " . $traffic_table . "\n WHERE traff_amts != '0'\n AND " . $traffic_table . ".number IN (\n SELECT " . $traffic_table . ".number \n FROM " . $traffic_table . ",phone \n WHERE " . $traffic_table . ".number = '" . $row1['number'] . "' \n AND phone.contract LIKE '%{$contract}')\n ;"; $row2 = mysql_fetch_array(mysql_query($query_cost_local)); $row3 = mysql_fetch_array(mysql_query($query_cost_zone)); $row4 = mysql_fetch_array(mysql_query($query_cost_amts)); $a1 = $row2['cost_local']; $a2 = $row3['cost_zone']; $a3 = $row4['cost_amts']; $cost_all_mgmnzone = $a1 + $a2 + $a3; $a11 = $a11 + $a1; $a22 = $a22 + $a2; $a33 = $a33 + $a3; $cost_mgmnzone = $a22 + $a33; $cost_all_all = $cost_all_all + $cost_all_mgmnzone; //Дорисовываем таблицу, заполняем данными///////////////// $csv_file .= $row1['number'] . ";" . $cost_all_mgmnzone . ";" . $a1 . ";" . $a2 . ";" . $a3 . ";" . ";\r\n"; // в качестве начала и конца полей я указал " (двойные кавычки) // в качестве разделителей полей я указал ; (запятая) // \r\n - это перенос строки ob_flush(); flush(); // Необходимо для работы - ob_flush usleep(50000); //Время задержки вывода инфы - 0.5 секунды. Вывод по 1 строке - конец } $query_cost_other = "\n SELECT SUM(other_cost) as cost_other\n FROM " . $traffic_table . ",department\n WHERE " . $traffic_table . ".contract = RIGHT(department.contract,3) \n AND department.contract LIKE '%{$contract}' \n ;"; $row5 = mysql_fetch_array(mysql_query($query_cost_other)); $a4 = $row5['cost_other']; $cost_all_all = $cost_all_all + $a4; $csv_file .= "Остальные затраты;" . ";" . ";" . ";" . ";" . $a4 . ";\r\n"; $csv_file .= "ИТОГО;" . $cost_all_all . ";" . $a11 . ";" . $a22 . ";" . $a33 . ";" . $a4 . ";\r\n"; $csv_file .= "ЛИМИТЫ (в мес.);" . $limit_all . ";;;" . $limit_AMTS . ";;\r\n"; $file_path = $_SERVER['DOCUMENT_ROOT'] . "/reports_ls_out/"; $file_name = 'Отчет по ЛС ' . $result_dep . ' за ' . $_GET['month'] . '.' . $_GET['year'] . '.csv'; // название файла $file = fopen($file_path . htmlspecialchars($file_name), "w"); // открываем файл для записи, если его нет, то создаем его в текущей папке, где расположен скрипт fwrite($file, trim($csv_file)); // записываем в файл строки fclose($file); // закрываем файл print '<b>Выгрузка данных в файл:</b> ' . $file_name . ' прошла успешно.'; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ echo "<br>"; $filename = $file_name; $path = $_SERVER['DOCUMENT_ROOT'] . "/reports_ls_out/"; $mailto = $mail; $from_mail = ""; //при отправке из MS Outlook через почтовый Exchenge сервер, отправителя указывать нельзя, иначе не даст права на отправку. $from_name = ""; //при отправке из MS Outlook через почтовый Exchenge сервер, отправителя указывать нельзя, иначе не даст права на отправку. $replyto = ""; $subject = "Отчет по услугам связи за " . $_GET['month'] . "." . $_GET['year']; $message = "" . $result_dep . ":\r\n\r\n"; $message .= "Всего потрачено по услугам связи: " . $cost_all_all . "руб. (лимит по управлению в мес.: " . $limit_all . "руб.)\r\n"; if ($cost_all_mgmnzone != '') { $message .= "\r\nВсего потрачено по междугородним (международным) переговорам: " . $cost_mgmnzone . "руб. (лимит по управлению в мес.: " . $limit_AMTS . "руб.)"; } mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } else { echo 'За период ' . $_GET['month'] . '.' . $_GET['year'] . ' по Управлению ' . $result_dep . ' в базе данны информации нет.'; } }
$header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--" . $uid . "\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message . "\r\n\r\n"; $header .= "--" . $uid . "\r\n"; $header .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n"; $header .= $content . "\r\n\r\n"; $header .= "--" . $uid . "--"; if (mail($mailto, $subject, "", $header)) { echo "mail send ... OK"; // or use booleans here } else { echo "mail send ... ERROR!"; } } $my_file = "prueba.pdf"; // puede ser cualquier formato $my_path = $_SERVER['DOCUMENT_ROOT'] . "/facturasPdf/"; $my_name = "Mercado Mundial"; $my_mail = "*****@*****.**"; $my_replyto = "*****@*****.**"; $my_subject = "Factura por compra de Servicios"; $my_message = "Le enviamos su factura por la compra del servicio de Mercado Mundial"; mail_attachment($my_file, $my_path, "*****@*****.**", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
include "mail/sendMail.php"; //include mailing function (in mail folder). if (isset($_POST['submit'])) { $to = $_POST['email']; //where to send email. $query = "select password from customers where email = '" . $_POST['email'] . "'"; //get the password for that email. $result = mysql_query($query, $con); if (!$result) { die("Invalid query! <br> The query is: " . $query); } $password = null; $safe = 0; //to check if we at least have one tuple in the query. while ($row = mysql_fetch_assoc($result)) { $password = $row['password']; $safe++; } if ($safe > 0) { mail_attachment(null, $to, null, 'Account Recovery', $message); } } ?> <form action="recovery.php" method = "post"> <a href= ""></a> </form>
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message . "\r\n\r\n"; $header .= "--" . $uid . "\r\n"; $header .= "Content-Type: application/vnd.ms-excel; name=\"" . $filename . "\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n"; $header .= $content . "\r\n\r\n"; $header .= "--" . $uid . "--"; if (mail($mailto, $subject, "", $header)) { echo "mail send ... OK"; } else { echo "mail send ... ERROR!"; } } $to = "USI_ClaimsFinance@usimagingnetwork.com, USImaging_IT@usimagingnetwork.com"; $from_mail = "*****@*****.**"; $from_name = "<US Imaging IT>"; $replyto = "*****@*****.**"; $subject = "Cashin By TPA check date "; $message = "Cashin By TPA check date completed. See attached file."; mail_attachment($file, $location, $to, $from_mail, $from_name, $replyto, $subject, $message); } else { $to = "*****@*****.**"; $from_mail = "*****@*****.**"; $from_name = "<US Imaging IT>"; $replyto = "*****@*****.**"; $subject = "[Important] Cashin By TPA check date failed"; $message = "File not found: " . $filename; }
//$filename = $_FILES['resumeFile']["name"]; //move_uploaded_file($_FILES["resumeFile"]["tmp_name"], $filename); $filename; $filesize; foreach ($_FILES as $file) { $filename = $file['name']; $fileInfo = pathinfo($filename); $filename = uniqid() . "." . $fileInfo["extension"]; $filesize = $file['size']; move_uploaded_file($file['tmp_name'], $path . $filename); } if (!$isAsync || $isAsync == "false") { printSyncHeader(); } if ($filesize < 2000000 && isset($filesize) && $filesize != 0) { $sent = mail_attachment($filename, $path, $mailto, $mailto, $mailFromName, $mailto, "Someone has sent you their resume!", $emailBody); } else { $response = "File is too large. 2MB is the maximum file size allowed."; } //header('Location: ../contact.html'); if ($sent) { $response = "Thank you. Your resume has been submitted."; } else { $response = "Sorry, there was an error while submitting your request. Please try again."; } echo $response; if (!$isAsync || $isAsync == "false") { printSyncFooter(); } unlink($path . $filename); /*
// that should be called when the user clicks // (this is probably your phone number) $number = '+14155551212'; // Your email address. Voicemails will be sent here $email = '*****@*****.**'; // Your API token from Tropo $token = ''; // END configuration // ********************************************************** $action = array_key_exists('action', $_GET) ? $_GET['action'] : ''; switch ($action) { case 'tropo': print getTropo(); break; case 'record': mail_attachment($_FILES['filename']['tmp_name'], '', $email, $email, '', '', 'Voicemail from Tropo', 'You have received a new voicemail from your Tropo Click to Call.'); break; default: print form($token); break; } // Print out the code that Tropo will use to run this app. function printTropo() { $post = getself() . '?action=record'; $code = <<<EOD <?php call('+' . \$from); sleep(2); // Pause a moment after they answer. say('One moment, connecting you now.'); transfer({$number}, array(
$content .= "Код ссылки на страницу автора: <a href='http://cartoonbank.ru/?page_id=29&brand=" . $brand . "'>" . $author . "</a>\n\r"; $my_file = $slidename; $my_path = $_SERVER['DOCUMENT_ROOT'] . "ales/"; //echo "<br />my_path: ".$my_path."<br />"; $my_name = "cartoonbank"; $my_mail = "*****@*****.**"; $my_replyto = "*****@*****.**"; $my_subject = "ежедневная карикатура для анекдота.ру от картунбанка.ру"; $my_message = $content; //send email // self mail_attachment($my_file, $my_path, $mailto, $my_mail, $my_name, $my_replyto, $my_subject, $my_message); // verner mail_attachment($my_file, $my_path, $mailto1, $my_mail, $my_name, $my_replyto, $my_subject, $my_message); // kalininsky mail_attachment($my_file, $my_path, $mailto2, $my_mail, $my_name, $my_replyto, $my_subject, $my_message); $count = $count - 1; if (file_exists($export_dir . $slidename)) { unlink($export_dir . $slidename); //echo "\n\r>>>> slide removed"; } // Mark image as sent to the Anekdot.ru $update_sql = "update wp_fsr_post set anekdotru_date='" . date("d.m.y H:m:s") . "' where ID=" . $ID; $res = mysql_query($update_sql); if (!$res) { die('<br />' . $update_sql . '<br />Invalid delete query: ' . mysql_error()); } } if (count($arrAuthors) >= $howmanyemails) { pokazh($arrAuthors); exit;
function process_user_report($uid) { global $config; $mail = load_user_email($uid); if (!$mail) { return FALSE; } $sheets = $config['sheets']; foreach ($sheets as $index => $sheet) { if (empty($sheet)) { continue; } $sql = $sheet['sql']; $sql .= " WHERE product_apply.uid = " . $uid; $columns = $sheet['columns']; $name = $sheet['name']; $headers = array_values($columns); //初始化excel对象 $excel = init_excel(); //设置Excel第一行 init_excel_header($excel, $headers); $result = mysql_query($sql); if (!$result) { die("MYSQL error" . mysql_error()); } $crt_index = 1; while ($row = mysql_fetch_assoc($result)) { $data = array(); foreach ($columns as $column_name => $column) { $column_value = $row[$column_name]; if (!$column_value) { $column_value = "无信息记录"; } if (function_exists('process_' . $column_name)) { $column_value = call_user_func('process_' . $column_name, $column_value); } $data[] = $column_value; } excel_write_one_row($excel, $data, $crt_index); $crt_index += 1; } excel_rename_sheet($excel, $index, $name); $path = save_excel($excel, 'product_apply' . $uid); //$to = '*****@*****.**'; $to = '*****@*****.**'; $from = '*****@*****.**'; $message = "您好,\n附件是您在Masterprint 系统下印刷产品的使用统计数据.\n谢谢\n"; mail_attachment($to, '产品的印刷统计数据', wordwrap($message), $from, $path); } }
$dateTime = date('Y-m-d H:i:s'); $currDateTime = dateTimeToArray($dateTime, 0); // Set various email fields: to, from, subject, and so on $filename = "logFiles/logFile" . $currDateTime[0] . $currDateTime[1] . $currDateTime[2] . ".txt"; $to = "*****@*****.**"; $from = "*****@*****.**"; $from_name = "Sharvari Kapadia"; $replyto = "*****@*****.**"; $subject = "Trending Films Log File for " . $currDateTime[1] . "/" . $currDateTime[2]; $message = "Please find the Trending films Log File for " . $currDateTime[1] . "/" . $currDateTime[2] . "." . "If you have any questions, please speak with Matt or Lou."; // Updated contacts list $to = "*****@*****.**"; $from = "*****@*****.**"; $from_name = "CQuest at Bravo"; $replyto = "*****@*****.**"; mail_attachment($filename, $to, $from, $from_name, $replyto, $subject, $message); // --------------------------------------------------------------------- // // Function definition for mail_attachment() // --------------------------------------------------------------------- // function mail_attachment($filename, $to, $from, $from_name, $replyto, $subject, $message) { $file = $filename; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $header = "From: " . $from_name . " <" . $from . ">\r\n"; $header .= "Reply-To: " . $replyto . "\r\n";
$results = $readConnection->fetchAll($query); $header = array(); $csv_output = array(); $header = array('smsapi_id', 'order_id', 'customer_id', 'type_verification', 'mobile', 'mid', 'status', 'reason', 'created_time', 'delivered_time'); $csv_output[] = $header; foreach ($results as $result) { if ($result['type_verification'] == 1) { $type_verification = "Call from zoffio"; } if ($result['type_verification'] == 2) { $type_verification = "Missed Call"; } if ($result['type_verification'] == 3) { $type_verification = "SMS Pin Verification"; } $csv_output[] = array('smsapi_id' => $result['smsapi_id'], 'order_id' => $result['order_id'], 'customer_id' => $result['customer_id'], 'type_verification' => $type_verification, 'mobile' => $result['mobile'], 'mid' => $result['mid'], 'status' => $result['status'], 'reason' => $result['reason'], 'created_time' => $result['created_time'], 'delivered_time' => $result['delivered_time']); } $fp = fopen('/home2/html/zofya/public_html/uniware/csv/smsreport.csv', 'w'); foreach ($csv_output as $line) { fputcsv($fp, $line); } fclose($fp); $my_file = "smsreport.csv"; $my_path = "/home2/html/zofya/public_html/uniware/csv/"; $my_name = "Zoffio System"; $my_mail = "*****@*****.**"; $my_replyto = "*****@*****.**"; $my_subject = "SMS Report - " . $date; $my_message = "Hi Puneet,\r\nPlease Find the attachment for " . $date . " SMS Report.\r\n\r\nRegards,\r\nArun Prabhu"; mail_attachment($my_file, $my_path, "Puneet.saxena@zoffio.com,suparno.mojumder@zoffio.com", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
Sehr gut! Du kannst dein Number26 Konto sofort eröffnen. Dauert nur ein paar Minuten -- siehe E-Mail mit Einladungs-Code von Number26.<br/><br/> Bei Fragen einfach auf dieses E-Mail antworten (hallo@' . $tld . ').<br/><br/> Beste Grüße,<br/>hallo@' . $tld; mail_attachment(array(), null, $mailto, $from_mail, $from_name, $replyto, $subject, $message); } elseif (isset($json->title) && $json->title == 'Oooops') { $subject = '€ ' . $tld . ' Konto vorhanden'; $message = '<b>Hallo!</b><br/><br/> Sehr gut! Du kannst dich einfach mit deinem Number26 Kontodaten anmelden.<br/><br/> Es sind keine Daten für Dritte zugänglich.<br /><br /> Bei Fragen einfach auf dieses E-Mail antworten (hallo@' . $tld . ').<br/><br/> Beste Grüße,<br/>hallo@' . $tld; mail_attachment(array(), null, $mailto, $from_mail, $from_name, $replyto, $subject, $message); } else { $subject = '€ Rechnung zum testen'; $message = 'Hallo!<br/><br/>Hier ist deine Rechnung zum Testen.<br/><br/>Die Kontodaten sind echt. Das Geld erreicht einen Empfänger und wird für Kaffee verwendet. Danke für die Unterstützung von Open Source Software.<br/><br/>Bei Fragen einfach auf dieses E-Mail antworten (hallo@' . $tld . ').<br/><br/>Beste Grüße,<br/> team@' . $tld; mail_attachment($files, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message); } header('Content-Type: application/json'); echo json_encode(array('status' => 'OK', 'msg' => $email . ' is ok.')); } else { header('Content-Type: application/json'); echo json_encode(array('status' => 'ERROR', 'msg' => $email . ' seems to be no valid e-mail address.')); } /** * Validate an email address. * Provide email address (raw input) * Returns true if the email address has the email * address format and the domain exists. * * found @ http://www.linuxjournal.com/article/9585?page=0,3 */
} $html .= '</table>'; $conteudo = utf8_decode($html); file_put_contents("{$path}/" . $empresa['razao_social'] . "/" . $arquivo, $conteudo); } //echo "<p>".$path; $directory = $path; //diretorio para compactar $zipfile = './uploads/' . $path . '.zip'; // nome do zip gerado // Array de arquivos $filenames = array(); // Lê os arquivos $filenames = browse($directory); // cria zip, adiciona arquivos... $zip = new ZipArchive(); if ($zip->open($zipfile, ZIPARCHIVE::CREATE) !== TRUE) { exit("Não pode abrir: <{$zipfile}>\n"); } foreach ($filenames as $filename) { $file = $filename; $arquivo = substr($file, -3); $zip->addFile($filename, $filename); } $zip->close(); if (rmdir_r($path)) { // Para quem vai ser enviado o email mail_attachment("envio_grafica_" . date('dmYhis') . ".zip", $zipfile, "*****@*****.**", "*****@*****.**", "Eviar arquivos para a gráfica " . date("d-m-Y"), "*****@*****.**", "Crachás a confeccionar", "<p>Conforme ajustado, seguem novos pedidos de confecção de crachá.</p>"); redirect('movimentacoes/envio'); } exit;
// edit this to your specified name $strFromEmail = "*****@*****.**"; // edit this to your specified email address $strSubject = "super awesome pdf attached!"; // edit this to your specified subject text $strMessage = "Here is the file you requested."; // edit this to you specified message text // echo $_SERVER['DOCUMENT_ROOT']; // uncomment this line to determine where $_SERVER['DOCUMENT_ROOT'] points to. // edit your_path_here so that it completes the local server path to the file attachment $fileattpath = $_SERVER['DOCUMENT_ROOT'] . "/webmaster/"; $fileatttype = "application/pdf"; // edit this to your specified attached file type $fileattname = "lizpdf.pdf"; // edit this to your specified filename // call mail_attachment function mail_attachment($fileattname, $fileattpath, $fileatttype, $strTo, $strFromEmail, $strFromName, $strFromEmail, $strSubject, $strMessage); function mail_attachment($filename, $path, $filetype, $mailto, $from_mail, $from_name, $replyto, $subject, $message) { $file = $path . $filename; $file_size = filesize($file); $handle = fopen($file, "rb"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $header = "From: " . $from_name . " <" . $from_mail . ">\r\n"; $header .= "Reply-To: " . $replyto . "\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n";
/** * This contains all the system-wide phpmailer functions * @version $Id: phpmailer.php 40 2011-02-09 14:10:00Z biyi $ * @package Platform * @category Function * @author Biyi Akinpelu * @link mailto:biyi@entilda.com * @copyright Copyright (C) 2011 - 2012 The Platform Authors. All rights reserved. * @license GNU Public Licence, see LICENSE.php * Platform is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ function mail_send($subject, $body, $mail_to, $mail_from, $format = null, $copy_to = null, $attachment = null) { global $phpmailer; $phpmailer->Subject = $subject; $phpmailer->Body = $body; // set email format to HTML or PLAINTEXT switch ($format) { case 'text': // disable HTML $phpmailer->IsHTML(false); break; case 'html': default: $phpmailer->IsHTML(true); break; } if (!is_null($copy_to)) { mail_copy_to($copy_to); } else { mail_to($mail_to); } if (!is_null($attachment)) { mail_attachment($attachment); } $mail_send = $phpmailer->Send(); $phpmailer->ClearAllRecipients(); return $mail_send; }