if (strpos($to, ",") > 0) { $tmp = explode(",", $to); $to = array(); foreach ($tmp as $row) { $to[] = trim($row); } } if ($TO && $CC) { 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"]; }
/** * 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; }
if ($_POST["icalart"] == "client") { $v->returnCalendar(); } 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
$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 { $output .= 'Konnte kein PDF erstellen.<br>';
} else { echo 'Mail has sent successfully'; } } */ $subject = "Heartweb Subscription"; $mime = new Mail_Mime(); $text = "Hi<BR><BR>"; $text .= "Your subscription to the Heartweb application is due for renewal in 7days. TIf you would liek to carry on with your subscription then you will need renew through the application.<BR>"; $text .= "====== IMPORTANT INFORMATION =========<BR>"; $text .= "Please Note <BR>"; $text .= "The information contained within this report is of a confidential nature and should not be shared with any other person."; // text and html versions of email. $html = '<html><body>' . $text . '</body></html>'; $mime->setTXTBody($text); $mime->setHTMLBody($html); $mime->setFrom(SMTP_USER); $mime->setSubject($subject); $body = $mime->get(); $headers = $mime->headers(); $smtp = Mail::factory('smtp', array('host' => SMTP_HOST, 'port' => SMTP_PORT, 'auth' => true, 'username' => SMTP_USER, 'password' => SMTP_PASSWORD)); foreach ($return as $row) { $mailto = $row['username']; if (TRIM($mailto) != '') { $mailto = $smtp->send($mailto, $header, $body); } if (PEAR::isError($mail)) { echo 'Mail not send'; } else { echo 'Mail has sent successfully';