function backupMysql() { $createBackup = "mysqldump -u " . DB_USER . " --password="******" " . BACKUP_DBS . " > " . CURRENT_MYSQL_BACKUP_PATH . CURRENT_MYSQL_BACKUP_NAME; $createZip = "tar cvzf " . EXTENDED_MYSQL_BACKUP_NAME . ' ' . CURRENT_MYSQL_BACKUP_NAME; exec($createBackup); exec($createZip); $headers = array('From' => EMAIL_FROM . '<' . EMAIL_SEND . '>', 'Subject' => EMAIL_SUBJECT); $textMessage = EXTENDED_MYSQL_BACKUP_NAME; $htmlMessage = "This is a nightly backup run."; $mime = new Mail_Mime("\n"); $mime->setTxtBody($textMessage); $mime->setHtmlBody($htmlMessage); $mime->addAttachment(EXTENDED_MYSQL_BACKUP_NAME, 'text/plain'); $body = $mime->get(); $hdrs = $mime->headers($headers); $mail =& Mail::factory('mail'); $mail->send(EMAIL_REC, $hdrs, $body); unlink(CURRENT_MYSQL_BACKUP_NAME); unlink(EXTENDED_MYSQL_BACKUP_NAME); }
if ($_POST["bcc"]) { $headers["Bcc"] = $CC; } else { $headers["Cc"] = $CC; } } $BodyText = preg_replace("/(content-type:|bcc:|cc:|to:|from:)/im", "", $_POST["BodyText"]); $mime->setTXTBody(strip_tags($BodyText)); $anz = $_FILES["Datei"]["name"][0] != "" ? count($_FILES["Datei"]["name"]) : 0; $anh = false; if ($anz > 0) { for ($o = 0; $o < $anz; $o++) { if ($_FILES["Datei"]["name"][$o] != "") { //move_uploaded_file($_FILES["Datei"]["tmp_name"][$o],$tmpdir.$_FILES["Datei"]["name"][$o]); copy($_FILES["Datei"]["tmp_name"][$o], 'tmp/' . $_FILES["Datei"]["name"][$o]); $mime->addAttachment('tmp/' . $_FILES["Datei"]["name"][$o], $_FILES["Datei"]["type"][$o], $_FILES["Datei"]["name"][$o]); unlink('tmp/' . $_FILES["Datei"]["name"][$o]); $anh = true; } } } else { $headers["Content-Type"] = "text/plain; charset=" . $_SESSION["charset"]; } $body = $mime->get(array("text_encoding" => "quoted-printable", "text_charset" => $_SESSION["charset"])); $hdr = $mime->headers($headers); $mail->_params = "-f " . $user["email"]; $rc = $mail->send($to, $hdr, $body); if ($_SESSION['logmail']) { $f = fopen('log/maillog.txt', 'a'); if ($rc) { fputs($f, date("Y-m-d H:i") . ';ok;' . $TO . ';' . $CC . ';' . $user["name"] . ' <' . $user["email"] . '>;' . $Subject . ";\n");
/** * Send the email out. * @return err 0 if no error; otherwise a PEAR_Error object with the error. */ function send() { // sanity check required pieces if (empty($this->to_email)) { return PEAR::raiseError('to email cannot be empty.'); } if (empty($this->from_email)) { return PEAR::raiseError('from email cannot be empty.'); } // set up all headers $headers = array(); $recipients = $this->getRecipients(); $headers["To"] = join(", ", $recipients['To']); if (count($recipients['Cc'])) { $headers["Cc"] = join(", ", $recipients['Cc']); } if (count($recipients['Bcc'])) { $headers["Bcc"] = join(", ", $recipients['Bcc']); } // FROM if ($this->from_name != '') { $headers["From"] = "\"{$this->from_name}\" <{$this->from_email}>"; } else { $headers["From"] = "{$this->from_email}"; } // REPLY-TO if ($this->reply_to_email != '') { $headers["Reply-To"] = "{$this->reply_to_email}"; } // PRIORITY $headers["X-Priority"] = "{$this->priority}"; // SUBJECT $headers["Subject"] = $this->subject; // ENVELOPE ADDRESS - make things bounce to the right place $headers["Return-Path"] = $headers["Errors-To"] = "{$this->from_email}"; $headers["Errors-To"] = "{$this->from_email}"; // Add an x-mailer; reduces chance of being flagged as SPAM $headers["X-Mailer"] = "PHOCOA Web Framework Mailer"; // Right before we pull the body text/html, HTMLify the message if it // meets the criteria for HTMLification. This function does nothing // if htmlify_plain_text_only_messages is turned off. $this->htmlify(); // use PEAR::Mail_Mime to format message $mm = new Mail_Mime(); @$mm->setTXTBody($this->raw_message_text); if ($this->raw_message_html) { @$mm->setHTMLBody($this->raw_message_html); } // add attachments foreach ($this->attachments as $attachment_info) { $err = @$mm->addAttachment($attachment_info['file'], $attachment_info['type'], $attachment_info['name'], $attachment_info['isfile']); if (PEAR::isError($err)) { return $err; } } $mm_body = @$mm->get(); $mm_headers = @$mm->headers($headers); if (is_null($this->pear_mailer_config)) { $mailer =& Mail::factory($this->pear_mailer_driver); } else { $mailer =& Mail::factory($this->pear_mailer_driver, $this->pear_mailer_config); } if (PEAR::isError($mailer)) { return $mailer; } $err = @$mailer->send(array_keys($recipients['All']), $mm_headers, $mm_body); if (PEAR::isError($err)) { return $err; } return 0; }
} fclose($f); $pdf = new PDF(); $data = $pdf->LoadData($dir . $filecsv); $pdf->SetFont('Arial', '', 10); $pdf->AddPage(); $pdf->SetTitle('Packliste ab ' . $datum); $pdf->Titel('Packliste ab ' . $datum); $pdf->SetDrawColor(255, 255, 255); $pdf->BasicTable($data); $pdf->Output($dir . $filepdf, "F"); if (file_exists($dir . $filepdf)) { if ($_POST['weg'] == 2) { $headers = array("From" => $_SESSION['email'], "X-Mailer" => "PHP/" . phpversion(), "Subject" => 'Packliste ab ' . $datum); $mime = new Mail_Mime(array('eol' => "\n")); $csv = $mime->addAttachment($dir . $filecsv, mime_content_type($dir . $filecsv), $filecsv); $pdf = $mime->addAttachment($dir . $filepdf, mime_content_type($dir . $filepdf), $filepdf); $mime->setTXTBody('Packliste'); $hdrs = $mime->headers($headers); $body = $mime->get(); $mail = Mail::factory("mail"); $mail->_params = "-f " . $_SESSION['email']; $rc = $mail->send($_SESSION['email'], $hdrs, $body); $output = 'E-Mail verschickt'; #unlink($dir.$filepdf); } else { header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="packliste.pdf"'); readfile($dir . $filepdf); #unlink($dir.$filepdf); }
} else { if ($_POST["icalart"] == "mail") { $user = getUserStamm($_SESSION["loginCRM"]); $abs = sprintf("%s <%s>", $user["name"], $user["email"]); $Subject = "LxO-Kalender"; $v->setConfig('directory', "/tmp/"); // identify directory $v->saveCalendar(); // save calendar to file include_once "Mail.php"; include_once "Mail/mime.php"; $headers = array("Return-Path" => $abs, "Reply-To" => $abs, "From" => $abs, "X-Mailer" => "PHP/" . phpversion(), "Subject" => $Subject); $mime = new Mail_Mime("\n"); $mime->setTXTBody(""); echo "!" . $v->getConfig('directory') . "/" . $v->getConfig('filename') . "!" . $v->getConfig('filename') . "!"; $mime->addAttachment($v->getConfig('directory') . "/" . $v->getConfig('filename'), "text/plain", $v->getConfig('filename')); $body = $mime->get(array("text_encoding" => "quoted-printable", "text_charset" => $_SESSION["charset"])); $hdr = $mime->headers($headers); $mail =& Mail::factory("mail"); $mail->_params = "-f " . $user["email"]; $rc = $mail->send($_POST["icaldest"], $hdr, $body); } else { if (strtoupper($_POST["icaldest"]) == "HOME") { $_POST["icaldest"] = "dokumente/" . $_SESSION["dbname"] . "/" . $_SESSION["login"] . "/"; } $v->setConfig('directory', $_POST["icaldest"]); // identify directory $v->saveCalendar(); // save calendar to file } }
$user = getUserStamm($_SESSION["loginCRM"]); $mail->_params = "-f " . $user["email"]; $subject = $headers["Subject"]; $betreff = $_SESSION["Subject"]; $bodytxt = $_SESSION["bodytxt"]; $limit = $_SESSION["limit"]; $abs = $headers["Return-Path"]; if ($_SESSION['logmail']) { $f = fopen("log/maillog.txt", "a"); } $dateiname = $_SESSION["dateiname"]; if ($dateiname) { $ftmp = fopen("./dokumente/" . $_SESSION["dbname"] . "/" . $_SESSION["login"] . "/SerMail/" . $dateiname, "rb"); $filedata = fread($ftmp, filesize("./dokumente/" . $_SESSION["dbname"] . "/" . $_SESSION["login"] . "/SerMail/" . $dateiname)); fclose($ftmp); $mime->addAttachment($filedata, $_SESSION["type"], $_SESSION["dateiname"], false); } $sql = "select * from tempcsvdata where uid = '" . $_SESSION["loginCRM"] . "' and id < 1"; $data = $_SESSION['db']->getAll($sql); $felder = explode(":", $data[0]["csvdaten"]); $pemail = array_search("EMAIL", $felder); $cid = array_search("ID", $felder); $pkont = array_search("KONTAKT", $felder); $sql = "select * from tempcsvdata where uid = '" . $_SESSION["loginCRM"] . "' order by id offset " . $offset . " limit " . $limit; $data = $_SESSION['db']->getAll($sql); if ($data) { $bodytxt = strip_tags($bodytxt); foreach ($data as $row) { $to = ""; $tmp = explode(":", $row["csvdaten"]); $text = $bodytxt;