コード例 #1
0
 public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
 {
     if (empty($to)) {
         Logger::trace("mail not sent: no recipients: {$subject}");
         return;
     }
     $config = Context::last()->config;
     if (empty($from)) {
         if (!($from = $config->get('modules/mail/from'))) {
             $from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
         }
     }
     if (strstr($body, '<html>') === false) {
         $body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
     }
     if (!is_array($to)) {
         $to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
     }
     Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
     $mail = new htmlMimeMail();
     if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
         $mail->setSMTPParams($server);
     }
     $mail->setFrom($from);
     $mail->setSubject($subject);
     $mail->setHtml(self::fixhtml($body));
     $mail->setTextCharset('UTF-8');
     $mail->setTextEncoding('base64');
     $mail->setHTMLCharset('UTF-8');
     $mail->setHTMLEncoding('UTF-8');
     $mail->setHeadCharset('UTF-8');
     foreach ((array) $attachments as $file) {
         $mail->addAttachment($file['data'], $file['name'], $file['type']);
     }
     foreach ((array) $headers as $k => $v) {
         if (!empty($v)) {
             $mail->setHeader($k, $v);
         }
     }
     return $mail->send($to, $transport);
 }
コード例 #2
0
 function mail_send($email_from, $subject, $sendto_email, $html_body, $plain_body, $randpath, $randfile)
 {
     $file = $html_mime_mail = new htmlMimeMail();
     $html_mime_mail->setFrom($email_from);
     $html_mime_mail->setSubject($subject);
     $html_mime_mail->setHtml($html_body, $plain_body);
     if ($randpath != '' && $randfile != '') {
         $html_mime_mail->addAttachment($html_mime_mail->getFile($randpath . $randfile), $randfile);
     }
     $success = $html_mime_mail->send(array($sendto_email), 'smtp');
     return $success;
 }
コード例 #3
0
<?php

/* $Revision: 1.7 $ */
/*Now this is not secure so a malicious user could send multiple emails of the report to the intended receipients

The intention is that this script is called from cron at intervals defined with a command like:

/usr/bin/wget http://localhost/web-erp/MailSalesReport.php

The configuration of this script requires the id of the sales analysis report to send
and an array of the receipients and the company database to use*/
/*The Sales report to send */
$ReportID = 4;
/*The company database to use */
$DatabaseName = 'weberp';
/*The people to receive the emailed report */
$Recipients = array('"Root" <root@localhost>', '"someone else" <*****@*****.**>');
/* ----------------------------------------------------------------------------------------------*/
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/CSVSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
$attachment = $mail->getFile($_SESSION['reports_dir'] . '/SalesAnalysis.csv');
$mail->setText(_('Please find herewith the comma seperated values sales report'));
$mail->addAttachment($attachment, 'SalesAnalysis.csv', 'application/csv');
$mail->setSubject(_('Sales Analysis') . ' - ' . _('CSV Format'));
$mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
$result = $mail->send($Recipients);
コード例 #4
0
     } else {
         $tm = time();
         $db->query("update subs_lists set lastsend='{$tm}' where id={$data['lid']}");
         $db->query("update subs_messages set date_sent='{$tm}' where id={$id}");
         header("Location: ?type=mod&mod_id=2&t=m&a=v&s={$i}");
     }
 }
 if ($a == 't') {
     $conf = conf();
     $db = new sql();
     $db->connect();
     $db->query("select * from subs_messages where id={$id}");
     $data = $db->fetch_array($db->result);
     $mail = new htmlMimeMail();
     if ($data["file"]) {
         $mail->addAttachment($mail->getFile("dl/" . $data["file"]), $data["file"]);
     }
     eval("\$conf[email_from]=\"" . $conf["email_from"] . "\";");
     $mail->setSubject($data["subj"]);
     $mail->setFrom($conf["email_from"]);
     $db->query("select subs_users.* from subs_users where email='" . $conf["test_email"] . "'");
     $lid = $data["lid"];
     $d = $db->fetch_array($db->result);
     $data["name"] = $d["name"] ? ", " . $d["name"] : "";
     $e = $d["email"];
     $x = $d["salt"];
     if ($data["text"]) {
         eval("\$text=\"" . $conf["text"] . "\";");
     }
     if ($data["html"]) {
         $content = $data["html"];
コード例 #5
0
    $YPos -= 2 * $line_height;
}
$YPos -= 2 * $line_height;
/*Print out the grand totals */
$LeftOvers = $pdf->addTextWrap(80, $YPos, 260 - $Left_Margin, $FontSize, _('Grand Total Value'), 'right');
$DisplayTotalVal = locale_money_format($Tot_Val, $_SESSION['CompanyRecord']['currencydefault']);
$LeftOvers = $pdf->addTextWrap(500, $YPos, 60, $FontSize, $DisplayTotalVal, 'right');
if ($_POST['DetailedReport'] == 'Yes') {
    $pdf->line($Left_Margin, $YPos + $line_height - 2, $Page_Width - $Right_Margin, $YPos + $line_height - 2);
    $YPos -= 2 * $line_height;
}
if ($ListCount == 0) {
    $title = _('Print Inventory Valuation Error');
    include 'includes/header.inc';
    echo '<br />' . _('There were no items with any value to print out for the location specified');
    echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
    include 'includes/footer.inc';
    exit;
    // Javier: needs check
} else {
    include 'includes/htmlMimeMail.php';
    $pdf->Output($_SESSION['reports_dir'] . '/InventoryReport.pdf', 'F');
    $pdf->__destruct();
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/InventoryReport.pdf');
    $mail->setText(_('Please find herewith the stock valuation report'));
    $mail->setSubject(_('Inventory Valuation Report'));
    $mail->addAttachment($attachment, 'InventoryReport.pdf', 'application/pdf');
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
    $result = $mail->send($Recipients);
}
コード例 #6
0
        $FromTransNo++;
    }
}
/* end loop to print invoices */
if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and isset($PrintPDF)) {
    if (isset($_GET['Email'])) {
        //email the invoice to address supplied
        include 'includes/header.inc';
        include 'includes/htmlMimeMail.php';
        $mail = new htmlMimeMail();
        $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf';
        $pdf->Output($FileName, 'F');
        $Attachment = $mail->getFile($FileName);
        $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']);
        $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']);
        $mail->addAttachment($Attachment, $FileName, 'application/pdf');
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send(array($_GET['Email']));
        unlink($FileName);
        //delete the temporary file
        $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo;
        include 'includes/header.inc';
        echo '<br />' . $InvOrCredit . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email'];
        include 'includes/footer.inc';
        exit;
    } else {
        $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf');
    }
    $pdf->__destruct();
} else {
    /*The option to print PDF was not hit */
コード例 #7
0
and an array of the receipients */
/*The following three variables need to be modified for the report - the company database to use and the receipients */
/*The Sales report to send */
$_GET['ReportID'] = 2;
/*The company database to use */
$DatabaseName = 'kwamojademo';
/*The people to receive the emailed report */
$Recipients = array('"Root" <root@localhost>', '"' . _('someone else') . '" <*****@*****.**>');
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/PDFSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
if ($Counter > 0) {
    /* the number of lines of the sales report is more than 0  ie there is a report to send! */
    $pdfcode = $pdf->output();
    $fp = fopen($_SESSION['reports_dir'] . '/SalesReport.pdf', 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/SalesReport.pdf');
    $mail->setText(_('Please find herewith sales report'));
    $mail->SetSubject(_('Sales Analysis Report'));
    $mail->addAttachment($attachment, 'SalesReport.pdf', 'application/pdf');
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
    $result = $mail->send($Recipients);
} else {
    $mail->setText(_('Error running automated sales report number') . ' ' . $ReportID);
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
    $result = $mail->send($Recipients);
}
コード例 #8
0
ファイル: example.1.php プロジェクト: 4v4t4r/CTF-LCC
$text = $mail->getFile('example.txt');
$html = $mail->getFile('example.html');
/*
 * Add the text, html and embedded images.
 * The name (background.gif in this case)
 * of the image should match exactly
 * (case-sensitive) to the name in the html.
 */
$mail->setHtml($html, $text);
$mail->addHtmlImage($background, 'background.gif', 'image/gif');
/*
 * This is used to add an attachment to
 * the email. Due to above, the $attachment
 * variable contains the example zip file.
 */
$mail->addAttachment($attachment, 'example.zip', 'application/zip');
/*
 * Set the return path of the message
 */
$mail->setReturnPath('*****@*****.**');
/**
 * Set some headers
 */
$mail->setFrom('"Joe" <*****@*****.**>');
$mail->setSubject('Test mail');
$mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');
/**
 * Send it using SMTP. If you're using Windows you should *always* use
 * the smtp method of sending, as the mail() function is buggy.
 */
$result = $mail->send(array('postmaster@localhost'), 'smtp');
コード例 #9
0
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans\n\t\t\tON salesorderdetails.orderno=debtortrans.order_ INNER JOIN stockmaster\n\t\t\tON salesorderdetails.stkcode=stockmaster.stockid INNER JOIN salesorders\n\t\t\tON salesorderdetails.orderno = salesorders.orderno INNER JOIN locationusers\n\t\t\tON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\tWHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'\n\t\tAND stockmaster.categoryid='" . $_POST['CategoryID'] . "'";
} elseif ($_POST['CategoryID'] == 'All' and $_POST['Location'] != 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans\n\t\t\tON salesorderdetails.orderno=debtortrans.order_ INNER JOIN salesorders\n\t\t\tON salesorderdetails.orderno = salesorders.orderno INNER JOIN locationusers\n\t\t\tON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\tWHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'\n\t\tAND salesorders.fromstkloc='" . $_POST['Location'] . "'";
} elseif ($_POST['CategoryID'] != 'All' and $_POST['Location'] != 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans ON salesorderdetails.orderno=debtortrans.order_\n\t\t\tINNER JOIN salesorders ON salesorderdetails.orderno = salesorders.orderno\n\t\t\tINNER JOIN locationusers ON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\tINNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid\n\t\tWHERE salesorders.fromstkloc ='" . $_POST['Location'] . "'\n\t\tAND categoryid='" . $_POST['CategoryID'] . "'\n\t\tAND trandate >='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "'";
}
$ErrMsg = _('Could not retrieve the count of sales order lines in the period under review');
$result = DB_query($sql, $ErrMsg);
$myrow = DB_fetch_row($result);
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('Total number of order lines') . ' ' . locale_number_format($myrow[0]), 'left');
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('DIFOT') . ' ' . locale_number_format((1 - $TotalDiffs / $myrow[0]) * 100, 2) . '%', 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_DIFOT_' . date('Y-m-d') . '.pdf';
$pdf->OutputD($ReportFileName);
if ($_POST['Email'] == 'Yes') {
    $pdf->Output($_SESSION['reports_dir'] . '/' . $ReportFileName, 'F');
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $ReportFileName);
    $mail->setText(_('Please find herewith DIFOT report from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, 'DIFOT.pdf', 'application/pdf');
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
    if ($_SESSION['SmtpSetting'] == 0) {
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send(array($_SESSION['FactoryManagerEmail']));
    } else {
        $result = SendmailBySmtp($mail, array($_SESSION['FactoryManagerEmail']));
    }
}
$pdf->__destruct();
コード例 #10
0
ファイル: tiki-webmail.php プロジェクト: noikiy/owaspbwa
 if (isset($_REQUEST["reply"]) || isset($_REQUEST["replyall"])) {
     check_ticket('webmail');
     $webmaillib->set_mail_flag($current["accountId"], $user, $_REQUEST["realmsgid"], 'isReplied', 'y');
 }
 $smarty->assign('sent', 'n');
 $smarty->assign('attaching', 'n');
 if (isset($_REQUEST["send"])) {
     $mail = new htmlMimeMail();
     $mail->setFrom($current["account"]);
     $mail->setCc($_REQUEST["cc"]);
     $mail->setBcc($_REQUEST["bcc"]);
     $mail->setSubject($_REQUEST["subject"]);
     if ($_REQUEST["attach1"]) {
         check_ticket('webmail');
         $a1 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach1file"]);
         $mail->addAttachment($a1, $_REQUEST["attach1"], $_REQUEST["attach1type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach1file"]);
     }
     if ($_REQUEST["attach2"]) {
         check_ticket('webmail');
         $a2 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach2file"]);
         $mail->addAttachment($a2, $_REQUEST["attach2"], $_REQUEST["attach2type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach2file"]);
     }
     if ($_REQUEST["attach3"]) {
         check_ticket('webmail');
         $a3 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach3file"]);
         $mail->addAttachment($a3, $_REQUEST["attach3"], $_REQUEST["attach3type"]);
         @unlink('temp/mail_attachs/' . $_REQUEST["attach3file"]);
     }
     $mail->setSMTPParams($current["smtp"], $current["smtpPort"], '', $current["useAuth"], $current["username"], $current["pass"]);
コード例 #11
0
         $NoLines = $LineNumber;
     } elseif ($LineDetails['section'] == 'Summary') {
         $MsgLineText = $LineDetails['linetext'];
         include 'includes/EDIVariableSubstitution.inc';
     }
 }
 /*end while there are message lines to parse and substitute vbles for */
 fclose($fp);
 /*close the file at the end of each transaction */
 //DB_query("UPDATE DebtorTrans SET EDISent=1 WHERE ID=" . $TransDetails['ID'],$db);
 /*Now send the file using the customer transport */
 if ($CustDetails['editransport'] == 'email') {
     $mail = new htmlMimeMail();
     $attachment = $mail->getFile($_SESSION['EDI_MsgPending'] . "/EDI_INV_" . $EDITransNo);
     $mail->SetSubject('EDI Invoice/Credit Note ' . $EDITransNo);
     $mail->addAttachment($attachment, 'EDI_INV_' . $EDITransNo, 'application/txt');
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
     if ($_SESSION['SmtpSetting'] == 0) {
         $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
         $MessageSent = $mail->send(array($CustDetails['ediaddress']));
     } else {
         $MessageSent = SendmailBySmtp($mail, array($CustDetails['ediaddress']));
     }
     if ($MessageSent == True) {
         echo '<br /><br />';
         prnMsg(_('EDI Message') . ' ' . $EDITransNo . ' ' . _('was successfully emailed'), 'success');
     } else {
         echo '<br /><br />';
         prnMsg(_('EDI Message') . ' ' . $EDITransNo . _('could not be emailed to') . ' ' . $CustDetails['ediaddress'], 'error');
     }
 } else {
コード例 #12
0
ファイル: MailSalesReport.php プロジェクト: rrsc/KwaMoja
    prnMsg(_('There are no members of the Sales Analysis Report Recipients email group'), 'warn');
    include 'includes/footer.inc';
    exit;
}
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/PDFSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
if ($Counter > 0) {
    $pdf->Output($_SESSION['reports_dir'] . '/SalesAnalysis_' . date('Y-m-d') . '.pdf', 'F');
    //save to file
    $pdf->__destruct();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/SalesAnalysis_' . date('Y-m-d') . '.pdf');
    $mail->setText(_('Please find herewith sales report'));
    $mail->SetSubject(_('Sales Analysis Report'));
    $mail->addAttachment($attachment, 'SalesAnalysis_' . date('Y-m-d') . '.pdf', 'application/pdf');
    if ($_SESSION['SmtpSetting'] == 0) {
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send($Recipients);
    } else {
        $result = SendmailBySmtp($mail, $Recipients);
    }
} else {
    $mail->setText(_('Error running automated sales report number') . ' ' . $ReportID);
    if ($_SESSION['SmtpSetting'] == 0) {
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send($Recipients);
    } else {
        $result = SendmailBySmtp($mail, $Recipients);
    }
}
コード例 #13
0
 /**
  * Enter description here...
  *
  * @param htmlMimeMail $mail
  * @param unknown_type $fromAdress
  * @param unknown_type $fromName
  * @return unknown
  */
 public function prepareEmail(htmlMimeMail $mail, $fromAdress, $fromName)
 {
     // Adds attachments
     foreach ($this->attachments as $attach) {
         $mail->addAttachment($attach['body'], $attach['name'], $attach['c_type'], $attach['encoding']);
     }
     // Subject, To, Cc
     $mail->setSubject($this->subject);
     $to = (array) $this->to;
     if (!empty($this->cc)) {
         $mail->setCc($this->cc);
     }
     // Bcc
     $bcc = $this->cci;
     $alwaysBcc = CopixConfig::get('|mailAlwaysBcc');
     if (!empty($alwaysBcc)) {
         $bcc = empty($bcc) ? $alwaysBcc : "{$alwaysBcc}; {$bcc}";
     }
     if (!empty($bcc)) {
         $mail->setBcc($bcc);
     }
     // Adresse de retour
     $fromAdress = $fromAdress == null ? $this->from : $fromAdress;
     $fromName = $fromName == null ? $this->fromName : $fromName;
     $mail->setFrom('"' . $fromName . '" <' . $fromAdress . '>');
     return $to;
 }
コード例 #14
0
ファイル: pdf.php プロジェクト: SalokineTerata/intranet
switch (0) {
    case 0:
        //Le fichier n'est pas à envoyer donc on l'affiche à l'écran
        $pdf->Output();
        //Read the FPDF.org manual to know the other options
        break;
    case 1:
        //Le fichier pdf doit être envoyé par mail
        //Définition des Variables
        //Nom du fichier pièce jointe
        $tmp_filename = "Agis-FTMP" . $id_dossier_matiere_premiere . "v" . $version_matiere_premiere . ".pdf";
        $tmp_pdf = $pdf->Output($tmp_file, "S");
        $text = stripslashes($text);
        //Création du mail
        $mail = new htmlMimeMail();
        $mail->addAttachment($tmp_pdf, $tmp_filename, 'application/pdf');
        $mail->setFrom($mail_user);
        $mail->setSubject("Agis: Fiche Technique Article");
        $mail->setText($text);
        $result = $mail->send(array($adresse_to), 'smtp');
        //       echo $adresse_to;
        if (!$result) {
            print_r($mail->errors);
        } else {
            $titre = "Envoi Réussi !";
            $message = "Votre mail à bien été envoyé à:<br>{$adresse_to}";
            $redirection = "";
            Lib::showMessage($titre, $message, $redirection);
            //echo 'Mail sent!';
        }
        //echo $GLOBALS['smtp_ip'];
コード例 #15
0
        /*Then set up a new page */
        $PageNumber++;
        include 'includes/PDFChequeListingPageHeader.inc';
    }
    /*end of new page header  */
}
/* end of while there are customer receipts in the batch to print */
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 60, $FontSize, locale_money_format($TotalCheques, $Currency), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin + 65, $YPos, 300, $FontSize, _('TOTAL') . ' ' . $Currency . ' ' . _('CHEQUES'), 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_ChequeListing_' . date('Y-m-d') . '.pdf';
$pdf->OutputD($ReportFileName);
//UldisN
$pdf->__destruct();
//UldisN
if ($_POST['Email'] == 'Yes') {
    if (file_exists($_SESSION['reports_dir'] . '/' . $ReportFileName)) {
        unlink($_SESSION['reports_dir'] . '/' . $ReportFileName);
    }
    $fp = fopen($_SESSION['reports_dir'] . '/' . $ReportFileName, 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $ReportFileName);
    $mail->setText(_('Please find herewith payments listing from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, 'PaymentListing.pdf', 'application/pdf');
    $mail->setFrom(array('"' . $_SESSION['CompanyRecord']['coyname'] . '" <' . $_SESSION['CompanyRecord']['email'] . '>'));
    /* $ChkListingRecipients defined in config.php */
    $result = $mail->send($ChkListingRecipients);
}
コード例 #16
0
chdir($kwamoja_home);
// get me the report name from the command line
$_GET['ReportID'] = $reportnumber;
$Recipients = explode(";", $emailaddresses);
//wrap in angles so that mail can accept it
for ($i = 0; $i < count($Recipients); $i++) {
    $Recipient[$i] = "<" . $Recipient[$i] . ">";
}
$AllowAnyone = true;
include 'includes/session.inc';
include 'includes/ConstructSQLForUserDefinedSalesReport.inc';
include 'includes/PDFSalesAnalysis.inc';
include 'includes/htmlMimeMail.php';
$mail = new htmlMimeMail();
if ($Counter > 0) {
    /* the number of lines of the sales report is more than 0  ie there is a report to send! */
    $pdfcode = $pdf->output();
    $fp = fopen($_SESSION['reports_dir'] . "/" . $reportname, "wb");
    fwrite($fp, $pdfcode);
    fclose($fp);
    $attachment = $mail->getFile($_SESSION['reports_dir'] . "/" . $reportname);
    $mail->setText($mailtext . "\nPlease find herewith " . $reportname . "  report");
    $mail->setSubject($reportname . " Report");
    $mail->addAttachment($attachment, $reportname, 'application/pdf');
    $mail->setFrom("");
    $result = $mail->send($Recipients);
} else {
    $mail->setText("Error running automated sales report number {$ReportID}");
    $mail->setFrom("Do_not_reply_" . $_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
    $result = $mail->send($Recipients);
}
コード例 #17
0
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     $pdf->Output('PurchOrder.pdf', 'I');
 } else {
     /* must be MakingPDF to email it */
     $pdfcode = $pdf->output();
     $fp = fopen($_SESSION['reports_dir'] . '/PurchOrder.pdf', 'wb');
     fwrite($fp, $pdfcode);
     fclose($fp);
     include 'includes/htmlMimeMail.php';
     $mail = new htmlMimeMail();
     $attachment = $mail->getFile($_SESSION['reports_dir'] . '/PurchOrder.pdf');
     $mail->setText(_('Please find herewith our purchase order number') . ' ' . $OrderNo);
     $mail->setSubject(_('Purchase Order Number') . ' ' . $OrderNo);
     $mail->addAttachment($attachment, 'PurchOrder.pdf', 'application/pdf');
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
     $result = $mail->send(array($_POST['EmailTo']));
     if ($result == 1) {
         $failed = false;
         echo '<p>';
         prnMsg(_('Purchase Order') . ' ' . $OrderNo . ' ' . _('has been emailed to') . ' ' . $_POST['EmailTo'] . ' ' . _('as directed'), 'success');
     } else {
         $failed = true;
         echo '<p>';
         prnMsg(_('Emailing Purchase order') . ' ' . $OrderNo . ' ' . _('to') . ' ' . $_POST['EmailTo'] . ' ' . _('failed'), 'error');
     }
 }
 if ($ViewingOnly == 0 && !$failed) {
     $commentsql = 'SELECT initiator,stat_comment FROM purchorders WHERE orderno=' . $OrderNo;
     $commentresult = DB_query($commentsql, $db);
コード例 #18
0
        while ($TaxGroupTaxesRow = DB_fetch_array($TaxGroupTaxesResult)) {
            $SQLScript .= "INSERT INTO taxgrouptaxes (taxgroupid,\n                                                        taxauthid,\n                                                        calculationorder,\n                                                        taxontax)\n                                   VALUES (" . $TaxGroupTaxesRow['taxgroupid'] . ",\n                                           " . $TaxGroupTaxesRow['taxauthid'] . ",\n                                           " . $TaxGroupTaxesRow['calculationorder'] . ",\n                                           " . $TaxGroupTaxesRow['taxontax'] . ");\n";
        }
        $SQLScript .= "SET FOREIGN_KEY_CHECKS=1;";
        /*Now write $SQLScript to a file */
        $FileHandle = fopen("./companies/" . $_SESSION['DatabaseName'] . "/reports/" . $_POST['TemplateName'] . ".sql", "w");
        fwrite($FileHandle, $SQLScript);
        fclose($FileHandle);
        echo '<P><a href="' . $RootPath . '/companies/' . $_SESSION['DatabaseName'] . '/reports/' . $_POST['TemplateName'] . '.sql">' . _('Show the sql template file produced') . '</a>';
        include 'includes/htmlMimeMail.php';
        $Recipients = array('"Submissions" <*****@*****.**>');
        $mail = new htmlMimeMail();
        $Host = $_SERVER['HTTP_HOST'];
        $attachment = $mail->getFile('http://' . $Host . $RootPath . '/companies/' . $_SESSION['DatabaseName'] . '/reports/' . $_POST['TemplateName'] . '.sql');
        $mail->setText('Please find company template ' . $_POST['TemplateName']);
        $mail->addAttachment($attachment, 'CompanyTemplate.sql', 'application/txt');
        $mail->setSubject('Company Template Submission');
        if ($_SESSION['SmtpSetting'] == 0) {
            $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
            $result = $mail->send($Recipients);
        } else {
            $result = SendmailBySmtp($mail, $Recipients);
        }
        /*end of SQL Script creation */
    }
    /*end if Input error*/
}
/*end submit button hit */
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
echo '<div class="centre">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
コード例 #19
0
ファイル: formmail.class.inc.php プロジェクト: Nenet/Urban
 /**
  * Replace placeholders in mail templates and send
  * e-mails.
  */
 function send_mail($mail_content, $content_data, $post_data = null)
 {
     global $text_wrap, $my_sendmail, $send_alternative_mail, $debug_mode, $sender_count, $sender_duration, $recipient_count, $recipient_duration, $txt, $remove_tags, $tplt, $configuration;
     $multiple = $this->collect_multiples($post_data);
     $mail_content = $this->replace_multiples($mail_content, $multiple);
     for ($i = 0; $i < count($mail_content); $i++) {
         /**
          * Replace placeholder with form, text (from language
          * file) and environment data
          */
         $mail_content[$i] = $this->replace_values($mail_content[$i], $post_data);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $txt);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $content_data);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $this->get_environment_var($_SERVER));
         //$mail_content[$i] = $this->replace_values($mail_content[$i], $url);
         /**
          * Remove unselected value placeholders
          */
         $mail_content[$i] = $this->remove_values($mail_content[$i]);
         /**
          * Remove tags
          */
         // $mail_content[$i] = $this->clean_output($mail_content[$i], $remove_tags);
         /**
          * Strip slashes
          */
         $final_mail_content = stripslashes($mail_content[$i]);
         if ($this->validate_to($final_mail_content) == false) {
             continue;
         }
         /**
          * Check whether the user is allowed to send e-mails
          * with or to a certain e-mail address.
          */
         $sender = $this->get_header_info($mail_content[$i], 'From');
         $recipient = $this->get_header_info($mail_content[$i], 'To');
         // Check if recipient is blocked by domain
         if (sizeof($configuration['recipients_domains']) > 0) {
             foreach ($configuration['recipients_domains'] as $recipient_domain) {
                 $domain = '#' . preg_quote(trim($recipient_domain)) . '#';
                 if (preg_match($domain, $recipient) === 1) {
                     return array('status' => 'failed', 'message' => array(), 'mail_content' => $mail_content[$i]);
                 }
             }
         }
         if ($tplt == 'recom') {
             if ($limit = $this->check_value_limit($sender, $sender_count, $sender_duration, 4, $txt['txt_sender_expiration'])) {
                 $message[] = array('message' => $limit, 'fields' => '');
             }
             if ($limit = $this->check_value_limit($recipient, $recipient_count, $recipient_duration, 5, $txt['txt_recipient_expiration'])) {
                 $message[] = array('message' => $limit, 'fields' => '');
             }
             if (isset($message) and !empty($message)) {
                 return array('status' => 'failed', 'message' => $message);
             }
         }
         /**
          * Start attachment handling
          */
         $send_attachments = false;
         if (!empty($this->attachments) and is_array($this->attachments)) {
             $send_alternative_mail = 'yes';
             $send_attachments = true;
         }
         if (isset($configuration['attach_mail_vars']) and is_array($configuration['attach_mail_vars']) and sizeof($configuration['attach_mail_vars']) > 0) {
             $send_alternative_mail = 'yes';
             $send_attachments = true;
         }
         /**
          * Get sendmail path from php ini settings or use the
          * value of $my_sendmail.
          */
         if ($send_alternative_mail != 'yes') {
             $sendmail = @ini_get('sendmail_path');
             debug_mode($sendmail, 'ini_get()');
             if (empty($sendmail)) {
                 $sendmail = "/usr/sbin/sendmail -t ";
                 debug_mode($sendmail, 'empty($sendmail)');
             }
             if (isset($my_sendmail) and !empty($my_sendmail)) {
                 $sendmail = $my_sendmail;
                 debug_mode(array('$my_sendmail', $sendmail));
             }
             /**
              * Try to send e-mail by using popen() to access
              * sendmail.
              */
             if ($fd = @popen($sendmail, "w")) {
                 if (!@fputs($fd, $final_mail_content . "\n")) {
                     $send_alternative_mail = 'yes';
                     debug_mode(array($txt['txt_popen_error'] . ' - fputs()', gettype($fd), $fd));
                 }
                 pclose($fd);
             } else {
                 $send_alternative_mail = 'yes';
                 debug_mode(array($txt['txt_popen_error'] . ' - popen()', gettype($fd), $fd));
             }
             debug_mode($final_mail_content, 'Mail Content popen()');
         }
         /**
          * If popen() - or fputs() - fails, extract mail
          * header from the template and use the PHP  function
          * mail().
          */
         if ($send_alternative_mail == 'yes') {
             $header_info = explode("\n", $final_mail_content);
             $mail_subject = '';
             $mail_header = $this->mail_headers;
             $mail_header = join($mail_header, '|');
             unset($additional_headers);
             $attachment_headers = array();
             for ($k = 0; $k < count($header_info); $k++) {
                 $clean_header = trim($header_info[$k]);
                 if (empty($clean_header)) {
                     break;
                 }
                 if (preg_match("/^From:/i", $header_info[$k])) {
                     $mail_from = trim(preg_replace("/From:/i", '', $header_info[$k]));
                     $attachment_headers['From'] = $mail_from;
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^To:/i", $header_info[$k])) {
                     $mail_recipient = trim(preg_replace("/^To:/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^Subject:/i", $header_info[$k])) {
                     $mail_subject = trim(preg_replace("/^Subject:/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^X-Form-Mail-Attachment:/i", $header_info[$k])) {
                     if (trim(str_replace('X-Form-Mail-Attachment:', '', $header_info[$k])) == 'no') {
                         $send_attachments = false;
                     }
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^" . $mail_header . "/i", $header_info[$k], $match)) {
                     $additional_headers[] = $header_info[$k];
                     $attachment_headers[str_replace(':', '', $match[0])] = trim(preg_replace("/" . $match[0] . "/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
             }
             if (isset($header_info) and is_array($header_info)) {
                 $new_mail_content = trim(implode($header_info, "\n"));
                 $new_mail_content = str_replace("\r", '', $new_mail_content);
             } else {
                 $new_mail_content = '';
             }
             //                if (isset($additional_headers) and is_array($additional_headers)) {
             //                    $additional_headers = implode($additional_headers, "\n");
             //                } else {
             //                    $additional_headers = '';
             //                }
             /**
              * Wrap mail content (and only mail content - not
              * headers).
              */
             $new_mail_content = $this->wrap_content($new_mail_content, $text_wrap);
             /**
              * Send mail using simple mail function
              */
             if (!$send_attachments and $debug_mode != 'on' and $mail_recipient != '') {
                 //  @mail ($mail_recipient, $mail_subject, $new_mail_content, $additional_headers);
                 send_mail($mail_recipient, $mail_subject, $new_mail_content, $mail_from, $attachment_headers);
             }
             /**
              * Send mail using mail class
              */
             if ($send_attachments and $debug_mode != 'on' and $mail_recipient != '') {
                 $att = new htmlMimeMail();
                 // Switch to smtp mode
                 if ($configuration['mail_type'] == 'smtp') {
                     $type = 'smtp';
                     $smtp = $configuration['smtp'];
                     $att->setSMTPParams($smtp['host'], $smtp['port'], $smtp['helo'], $smtp['auth'], $smtp['user'], $smtp['pass']);
                 } else {
                     $type = 'mail';
                 }
                 // Register file attachments in mime class
                 foreach ($this->attachments as $file_name) {
                     $att->addAttachment($att->getFile($file_name['new']), $file_name['old']);
                 }
                 //Manage mail var attachments
                 if (isset($configuration['attach_mail_vars']) and is_array($configuration['attach_mail_vars']) and sizeof($configuration['attach_mail_vars']) > 0) {
                     foreach ($configuration['attach_mail_vars'] as $attach_type) {
                         if ($attach_type == 'vcard') {
                             $attach_config = array('mailvars' => $post_data, 'type' => G10E_ATTACH_TYPE_VCARD, 'control' => $this->control_fields);
                             if ($res = attach_mail_variables::get_content($attach_config)) {
                                 $att->addAttachment($res, 'vcard.vcf');
                             }
                         }
                         if ($attach_type == 'csv') {
                             $attach_config = array('mailvars' => $post_data, 'type' => G10E_ATTACH_TYPE_CSV, 'control' => $this->control_fields, 'csv_head' => true);
                             if ($res = attach_mail_variables::get_content($attach_config)) {
                                 $att->addAttachment($res, 'csv.csv');
                             }
                         }
                     }
                 }
                 // Register headers in mime class
                 $html = false;
                 if (isset($attachment_headers) and is_array($attachment_headers)) {
                     foreach ($attachment_headers as $key => $val) {
                         $att->setHeader($key, $val);
                         if ($key == 'Content-Type' and preg_match('#text/html#i', $val)) {
                             $att->setHtmlCharset($configuration['character_set']);
                             $att->setHtml($new_mail_content);
                             $html = true;
                         }
                     }
                 }
                 $att->setHeadCharset($configuration['character_set']);
                 $att->setSubject($mail_subject);
                 if ($html != true) {
                     $att->setTextCharset($configuration['character_set']);
                     $att->setText($new_mail_content);
                 }
                 $att->send(array($mail_recipient), $type);
             }
             debug_mode($mail_recipient, 'Mail Recipient mail()');
             debug_mode($mail_subject, 'Mail Subject mail()');
             debug_mode($new_mail_content, 'Mail Content mail()');
             debug_mode($additional_headers, 'Mail Additional Headers mail()');
         }
     }
     // -re- for
     $this->mail_content = $mail_content[0];
     return array('status' => 'ok', 'mail_content' => $this->mail_content);
 }
コード例 #20
0
}
if ($_SESSION['SalesmanLogin'] != '') {
    $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
}
$ErrMsg = _('Could not retrieve the count of sales order lines in the period under review');
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_row($result);
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('Total number of order lines') . ' ' . locale_number_format($myrow[0]), 'left');
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('DIFOT') . ' ' . locale_number_format((1 - $TotalDiffs / $myrow[0]) * 100, 2) . '%', 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_DeliveryDifferences_' . date('Y-m-d') . '.pdf';
$pdf->OutputD($ReportFileName);
if ($_POST['Email'] == 'Yes') {
    if (file_exists($_SESSION['reports_dir'] . '/' . $ReportFileName)) {
        unlink($_SESSION['reports_dir'] . '/' . $ReportFileName);
    }
    $pdf->Output($_SESSION['reports_dir'] . '/' . $ReportFileName, 'F');
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $ReportFileName);
    $mail->setText(_('Please find herewith delivery differences report from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, $ReportFileName, 'application/pdf');
    if ($_SESSION['SmtpSetting'] == 0) {
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send(array($_SESSION['FactoryManagerEmail']));
    } else {
        $result = SendmailBySmtp($mail, array($_SESSION['FactoryManagerEmail']));
    }
}
$pdf->__destruct();
コード例 #21
0
     }
     if ($LineDetails['section'] == 'Summary' and $LastLine == 'Detail') {
         $MsgLineText = $LineDetails['linetext'];
         include 'includes/EDIVariableSubstitution.inc';
     }
 }
 /*end while there are message lines to parse and substitute vbles for */
 fclose($fp);
 /*close the file at the end of each transaction */
 DB_query("UPDATE debtortrans SET EDISent=1 WHERE ID=" . $TransDetails['id']);
 /*Now send the file using the customer transport */
 if ($CustDetails['editransport'] == 'email') {
     $mail = new htmlMimeMail();
     $attachment = $mail->getFile("EDI_INV_" . $TransNo . ".txt");
     $mail->SetSubject('EDI Invoice/Credit Note ' . $TransNo);
     $mail->addAttachment($attachment, 'EDI_INV_' . $TransNo . '.txt', 'application/txt');
     if ($_SESSION['SmtpSetting'] == 0) {
         $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
         $MessageSent = $mail->send(array($CustDetails['ediaddress']));
     } else {
         $MessageSent = SendmailBySmtp($mail, array($CustDetails['ediaddress']));
     }
     if ($MessageSent == True) {
         echo '<BR><BR>';
         prnMsg(_('EDI Message') . ' ' . $TransNo . ' ' . _('was sucessfully emailed'), 'success');
     } else {
         echo '<BR><BR>';
         prnMsg(_('EDI Message') . ' ' . $TransNo . _('could not be emailed to') . ' ' . $CustDetails['ediaddress'], 'error');
     }
 } else {
     /*it must be ftp transport */
コード例 #22
0
ファイル: PrintCustTrans.php プロジェクト: bodi000/weberp-cvs
 		include('includes/footer.inc');
 		exit;
 	}*/
 if (isset($_GET['Email'])) {
     //email the invoice to address supplied
     include 'includes/header.inc';
     include 'includes/htmlMimeMail.php';
     $mail = new htmlMimeMail();
     $filename = $_SESSION['reports_dir'] . '/Invoice.pdf';
     $fp = fopen($_SESSION['reports_dir'] . '/Invoice.pdf', 'wb');
     fwrite($fp, $pdfcode);
     fclose($fp);
     $attachment = $mail->getFile($filename);
     $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']);
     $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']);
     $mail->addAttachment($attachment, $filename, 'application/pdf');
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
     $result = $mail->send(array($_GET['Email']));
     unlink($filename);
     //delete the temporary file
     $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo;
     include 'includes/header.inc';
     echo "<p>{$InvOrCredit} " . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email'];
     include 'includes/footer.inc';
     exit;
 } else {
     header('Content-type: application/pdf');
     header('Content-Length: ' . $len);
     header('Content-Disposition: inline; filename=Customer_trans.pdf');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
コード例 #23
0
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_row($result);
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('Total number of order lines') . ' ' . number_format($myrow[0]), 'left');
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('DIFOT') . ' ' . number_format((1 - $TotalDiffs / $myrow[0]) * 100, 2) . '%', 'left');
$pdfcode = $pdf->output();
$len = strlen($pdfcode);
header('Content-type: application/pdf');
header('Content-Length: ' . $len);
header('Content-Disposition: inline; filename=DeliveryDifferences.pdf');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
$pdf->stream();
if ($_POST['Email'] == 'Yes') {
    if (file_exists($_SESSION['reports_dir'] . '/DeliveryDifferences.pdf')) {
        unlink($_SESSION['reports_dir'] . '/DeliveryDifferences.pdf');
    }
    $fp = fopen($_SESSION['reports_dir'] . '/DeliveryDifferences.pdf', 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/DeliveryDifferences.pdf');
    $mail->setText(_('Please find herewith delivery differences report from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']);
    $mail->addAttachment($attachment, 'DeliveryDifferences.pdf', 'application/pdf');
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
    /* $DelDiffsRecipients defined in config.php */
    $result = $mail->send($DelDiffsRecipients);
}
コード例 #24
0
ファイル: general.class.php プロジェクト: NioFBI/majordomo
function SendMail_HTML($from, $to, $subj, $body, $attach = "")
{
    // sending email as html
    //global $SERVER_SOFTWARE;
    $mail = new htmlMimeMail();
    $mail->setFrom($from);
    $mail->setSubject($subj);
    $mail->setHTML($body);
    $mail->setHTMLCharset('windows-1251');
    $mail->setHeadCharset('windows-1251');
    if (is_array($attach)) {
        $total = count($attach);
        for ($i = 0; $i < $total; $i++) {
            if (file_exists($attach[$i])) {
                $attach_data = $mail->getFile($attach[$i]);
                $mail->addAttachment($attach_data, basename($attach[$i]), '');
            }
        }
    } elseif (file_exists($attach) && $attach != "") {
        $attach_data = $mail->getFile($attach);
        $mail->addAttachment($attach_data, basename($attach), '');
    }
    $result = $mail->send(array($to));
    return $result;
}
コード例 #25
0
ファイル: example.5.php プロジェクト: 4v4t4r/CTF-LCC
*/
$mail_1->setCrlf("\n");
/**
* First email.
*/
$mail_1->setHTML($mail_1->getFile('example.html'), $mail_1->getFile('example.txt'), dirname(__FILE__) . '/');
/**
* Add the attachment
*/
$mail_1->addAttachment($mail_1->getFile('example.zip'), 'example.zip', 'application/zip');
/**
* Don't send this email, but use the
* get_rfc822() method to assign it to a
* variable.
*/
$mail_1->setReturnPath('*****@*****.**');
$mail_1->setFrom('John Doe <*****@*****.**>');
$mail_1->setSubject('Test attached email');
$mail = $mail_1->getRFC822(array('Nobody <*****@*****.**>'));
/**
* Now start a new mail, and add the first
* (which is now built and contained in
* $mail) to it.
*/
$mail_2 = new htmlMimeMail();
$mail_2->setText('This email has an attached email');
$mail_2->addAttachment($mail, 'Test for attached email', 'message/rfc822', '7bit');
$mail_2->setFrom('Foo <*****@*****.**>');
$mail_2->setSubject('Test with attached email');
$result = $mail_2->send(array('postmaster@localhost'));
echo $result ? 'Mail sent!' : 'Failed to send mail';