コード例 #1
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);
コード例 #2
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);
}
コード例 #3
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"];
コード例 #4
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);
}
コード例 #5
0
            $LeftOvers = $pdf->addTextWrap($FormDesign->Total->x, $Page_Height - $FormDesign->Total->y, $FormDesign->Total->Length, $FormDesign->Total->FontSize, $DisplayTotal, 'right');
        }
        /* end of check to see that there was an invoice record to print */
        $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');
    }
コード例 #6
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);
}
コード例 #7
0
ファイル: tools.php プロジェクト: BackupTheBerlios/facturaphp
function SendHtmlEmail($plantilla, $variables, $subject, $destino, $origen = "*****@*****.**", $imagenes = NULL, $imgdir = "img", $html = NULL)
{
    require_once 'mail.php';
    if (!$html) {
        $smarty = SmartyInit();
        $smarty->assign("variables", $variables);
        $body = $smarty->fetch($plantilla);
    } else {
        $body = $html;
    }
    $mail = new htmlMimeMail();
    // Definimos el html
    $mail->setHtml($body);
    // Comprobamos si hay imagenes embebidas en el correo
    if ($imagenes != NULL) {
        // Leemos todos los ficheros y los aadimos al correo
        foreach ($imagenes as $imagen) {
            $len = strlen($imagen);
            $extension = substr($imagen, $len - 3, 3);
            if ($extension == "gif") {
                $tipo = "image/gif";
            }
            if ($extension == "jpg") {
                $tipo = "image/jpg";
            }
            $fichero = $imgdir . "/" . $imagen;
            $temp = $mail->getFile($fichero);
            $mail->addHtmlImage($temp, $imagen, $tipo);
        }
    }
    // Definimos las cabeceras de los mensajes
    $mail->setReturnPath($origen);
    $mail->setFrom($origen);
    $mail->setSubject($subject);
    $mail->setHeader('X-Mailer', 'Correo enviado por pachecoforja.com');
    // Enviamos el correo
    $result = $mail->send(array($destino), 'smtp');
    if (!$result) {
        return $mail->errors;
    } else {
        return true;
    }
}
コード例 #8
0
         /*to make sure dont do the detail section again */
         $LastLine = 'Summary';
         $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');
コード例 #9
0
ファイル: tiki-webmail.php プロジェクト: noikiy/owaspbwa
 // Send a message
 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"]);
     }
コード例 #10
0
                                                 calculationorder,
                                                 taxontax
                                            FROM taxgrouptaxes', $db);
        while ($TaxGroupTaxesRow = DB_fetch_array($TaxGroupTaxesResult)) {
            $SQLScript .= "INSERT INTO taxgrouptaxes (taxgroupid,\r\n                                                        taxauthid,\r\n                                                        calculationorder,\r\n                                                        taxontax)\r\n                                   VALUES (" . $TaxGroupTaxesRow['taxgroupid'] . ",\r\n                                           " . $TaxGroupTaxesRow['taxauthid'] . "\r\n                                           " . $TaxGroupTaxesRow['calculationorder'] . "\r\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();
        $attachment = $mail->getFile($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');
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>');
        $result = $mail->send($Recipients);
        /*end of SQL Script creation */
    }
    /*end if Input error*/
}
/*end submit button hit */
echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
prnMsg(_('Running the create a new company template script will export all account groups, account codes and tax set up tables including tax groups, tax authorities, tax rates etc. However, no transactions or private data will be exported. There is opportunity to prevent specific general ledger accounts from being exported where these are considered private - again no transactional or balance data is exported and you can inspect the contents of the sql file. The template file will be emailed automatically to the webERP project'), 'info');
echo _('Enter the name of the template to be created') . ':<input type="text" name="TemplateName">';
prnMsg(_('Warning: All selected accounts will be exported - please de-select the accounts you do not wish to export to the new template file'), 'warn');
echo '<table>';
コード例 #11
0
ファイル: MailSalesReport.php プロジェクト: rrsc/KwaMoja
if (sizeOf($Recipients) == 0) {
    $Title = _('Inventory Valuation') . ' - ' . _('Problem Report');
    include 'includes/header.inc';
    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 {
コード例 #12
0
ファイル: example.4.php プロジェクト: 4v4t4r/CTF-LCC
* Last Modified..: 15 July 2002
*/
error_reporting(E_ALL);
include 'htmlMimeMail.php';
/**
* Example of usage. This example shows
* how to use the class to send Bcc: 
* and/or Cc: recipients.
*
* Create the mail object.
*/
$mail = new htmlMimeMail();
/**
* We will just send a text email
*/
$text = $mail->getFile('example.txt');
$mail->setText($text);
/**
* Send the email using smtp method. The setSMTPParams()
* method simply changes the HELO string to example.com
* as localhost and port 25 are the defaults.
*/
$mail->setSMTPParams('localhost', 25, 'example.com');
$mail->setReturnPath('*****@*****.**');
$mail->setBcc('*****@*****.**');
$mail->setCc('Carbon Copy <*****@*****.**>');
$result = $mail->send(array('postmaster@localhost'), 'smtp');
// These errors are only set if you're using SMTP to send the message
if (!$result) {
    print_r($mail->errors);
} else {
コード例 #13
0
     /* must be MakingPDF to email it */
     /* UldisN
     	  	$pdfcode = $pdf->output();
     		$fp = fopen( $_SESSION['reports_dir'] . '/PurchOrder.pdf','wb');
     		fwrite ($fp, $pdfcode);
     		fclose ($fp);
     		*/
     $PdfFileName = $_SESSION['DatabaseName'] . '_PurchaseOrder_' . date('Y-m-d') . '.pdf';
     $ReportsDirName = $_SESSION['reports_dir'];
     $pdf->Output($ReportsDirName . '/' . $PdfFileName, 'F');
     //UldisN
     $pdf->__destruct();
     //UldisN
     include 'includes/htmlMimeMail.php';
     $mail = new htmlMimeMail();
     $attachment = $mail->getFile($ReportsDirName . '/' . $PdfFileName);
     $mail->setText(_('Please find herewith our purchase order number') . ' ' . $OrderNo);
     $mail->setSubject(_('Purchase Order Number') . ' ' . $OrderNo);
     $mail->addAttachment($attachment, $PdfFileName, 'application/pdf');
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
     $result = $mail->send(array($_POST['EmailTo']));
     if ($result == 1) {
         $failed = false;
         echo '<br />';
         prnMsg(_('Purchase Order') . ' ' . $OrderNo . ' ' . _('has been emailed to') . ' ' . $_POST['EmailTo'] . ' ' . _('as directed'), 'success');
     } else {
         $failed = true;
         echo '<br />';
         prnMsg(_('Emailing Purchase order') . ' ' . $OrderNo . ' ' . _('to') . ' ' . $_POST['EmailTo'] . ' ' . _('failed'), 'error');
     }
 }
コード例 #14
0
ファイル: PDFDIFOT.php プロジェクト: xuxudodo/weberp-cvs
$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=DIFOT.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'] . '/DIFOT.pdf')) {
        unlink($_SESSION['reports_dir'] . '/DIFOT.pdf');
    }
    $fp = fopen($_SESSION['reports_dir'] . '/DIFOT.pdf', 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/DIFOT.pdf');
    $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'] . '>');
    /* $DelDiffsRecipients defined in config.php */
    $result = $mail->send($DelDiffsRecipients);
}
コード例 #15
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;
 }
コード例 #16
0
     header('Content-type: application/pdf');
     header('Content-Length: ' . $len);
     header('Content-Disposition: inline; filename=PurchaseOrder.pdf');
     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');
     }
 }
コード例 #17
0
ファイル: xapEnviar.php プロジェクト: rusoftware/GrupoNorte
  $nFilasTot = mysql_num_rows($nResultado) ;
  $nFilasAct = 0 ;

  while ($aRegistro = mysql_fetch_array($nResultado)) {
    $nFilasAct++ ;

    $oMail = new htmlMimeMail();
    $oMail->setHeader('X-Mailer', 'HTML Mime mail');
    $oMail->setHeader('MIME-Version', '1.0');
//  $oMail->setHeader('Content-type', 'text/html;charset=ISO-8859-9');
//  $oMail->setTextCharset("utf-8");
//  $oMail->setHTMLCharset("utf-8");
//  $oMail->setHeadCharset("utf-8");

    $cTexto = $oMail->getFile("./Newsletter/Newsletter.txt");
    $cTexto = str_replace("##Contenido##", $cContTexto, $cTexto);
    $cTexto = str_replace("##Nombre##", $aRegistro["NwsSuscNombre"], $cTexto);
    $cTexto = str_replace("##EMail##", $aRegistro["NwsSuscMail"], $cTexto);
    $cTexto = str_replace("##ClaveBaja##", md5("#".$aRegistro["NwsSuscCodigo"]."#".$aRegistro["NwsSuscMail"]."#"), $cTexto);

    $cHTML  = $oMail->getFile("./Newsletter/Newsletter.html");
    $cHTML  = str_replace("##Contenido##", $cContHTML, $cHTML);
    $cHTML  = str_replace("##Nombre##", $aRegistro["NwsSuscNombre"], $cHTML);
    $cHTML  = str_replace("##EMail##", $aRegistro["NwsSuscMail"], $cHTML);
    $cHTML  = str_replace("##ClaveBaja##", md5("#".$aRegistro["NwsSuscCodigo"]."#".$aRegistro["NwsSuscMail"]."#"), $cHTML);

    $oMail->setHtml($cHTML, $cTexto, '../');
    $oMail->setFrom($cDesdeMail);
    $oMail->setReturnPath($cRetorMail);
    $oMail->setSubject($cAsunto);
コード例 #18
0
    /*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, number_format($TotalCheques, 2), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin + 65, $YPos, 300, $FontSize, _('TOTAL') . ' ' . $Currency . ' ' . _('CHEQUES'), 'left');
$pdfcode = $pdf->output();
$len = strlen($pdfcode);
header('Content-type: application/pdf');
header('Content-Length: ' . $len);
header('Content-Disposition: inline; filename=ChequeListing.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'] . '/PaymentListing.pdf')) {
        unlink($_SESSION['reports_dir'] . '/PaymentListing.pdf');
    }
    $fp = fopen($_SESSION['reports_dir'] . '/PaymentListing.pdf', 'wb');
    fwrite($fp, $pdfcode);
    fclose($fp);
    include 'includes/htmlMimeMail.php';
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/PaymentListing.pdf');
    $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);
}
コード例 #19
0
ファイル: example.1.php プロジェクト: 4v4t4r/CTF-LCC
include 'htmlMimeMail.php';
/**
* Example of usage. This example shows
* how to use the class with html,
* embedded images, and an attachment.
*/
/**
 * Create the mail object.
 * No longer takes any arguments
 */
$mail = new htmlMimeMail();
/*
 * Read the image background.gif into
 * $background
 */
$background = $mail->getFile('background.gif');
/*
 * Read the file test.zip into $attachment.
 */
$attachment = $mail->getFile('example.zip');
/*
 * Get the contents of the example text/html files.
 * Text/html data doesn't have to come from files,
 * could come from anywhere.
 */
$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
コード例 #20
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);
 }
コード例 #21
0
        /*taxgroup taxes table */
        $TaxGroupTaxesResult = DB_query("SELECT taxgroupid,\n\t\t\t\t\t                                                 taxauthid,\n\t\t\t\t\t                                                 calculationorder,\n\t\t\t\t\t                                                 taxontax\n\t\t\t\t\t                                            FROM taxgrouptaxes");
        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') . '">';
コード例 #22
0
         $LastLine = 'Detail';
         $NoLines = $LineNumber;
     }
     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');
     }
コード例 #23
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();
コード例 #24
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);
}
コード例 #25
0
ファイル: PrintCustTrans.php プロジェクト: bodi000/weberp-cvs
 /*	if ($len <1020){
 		include('includes/header.inc');
 		echo '<p>' . _('There were no transactions to print in the range selected');
 		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);
コード例 #26
0
ファイル: example.3.php プロジェクト: 4v4t4r/CTF-LCC
*/
error_reporting(E_ALL);
include 'htmlMimeMail.php';
/**
* Example of usage. This example shows
* how to use the class to send a plain
* text email with an attachment. No html,
* or embedded images.
*
* Create the mail object.
*/
$mail = new htmlMimeMail();
/**
* Read the file test.zip into $attachment.
*/
$attachment = $mail->getFile('example.zip');
/**
* Since we're sending a plain text email,
* we only need to read in the text file.
*/
$text = $mail->getFile('example.txt');
/**
* To set the text body of the email, we
* are using the setText() function. This
* is an alternative to the setHtml() function
* which would obviously be inappropriate here.
*/
$mail->setText($text);
/**
* This is used to add an attachment to
* the email.
コード例 #27
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;
}
コード例 #28
0
ファイル: example.5.php プロジェクト: 4v4t4r/CTF-LCC
* and attachment. This is then attached
* to the second email which is plain text.
*
* Create the mail object.
*/
$mail_1 = new htmlMimeMail();
/**
* This call is usually not necessary unless you're sending the final
* mail via SMTP (Qmail won't send mail with bare LFs and you must
* therefore use CRLF), but setting this explicitly doesnt hurt.
*/
$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