Exemplo n.º 1
0
 function m_sendMail()
 {
     $libFunc = new c_libFunctions();
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_VAR_CMS", MODULES_PATH . "default/templates/main/contactmail.tpl.htm");
     $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($this->request['sName']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($this->request['sAddress1']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($this->request['sAddress2']));
     $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($this->request['sWorkPhone']));
     $this->ObTpl->set_var("TPL_VAR_COUNTRY", $this->libFunc->m_displayContent($this->request['sCountry']));
     $this->ObTpl->set_var("TPL_VAR_COMMENTS", nl2br($this->libFunc->m_displayContent($this->request['sComments'])));
     $message = "========================================<br />";
     $message .= "Contact request from " . SITE_NAME . "<br />";
     $message .= "========================================<br />";
     $message .= $this->ObTpl->parse("return", "TPL_VAR_CMS");
     $this->request['sName'] . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $this->libFunc->m_displayContent($this->request['sName']) . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail->setFrom($this->libFunc->m_displayContent1("\"" . $this->request['sName'] . "\"") . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">");
     $obMail->setSubject("Contact request from " . SITE_NAME);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     $result = $obMail->send(array(ENQUIRY_EMAIL));
 }
Exemplo n.º 2
0
 function EmailSuppliers()
 {
     $EmailText = _('This email has been automatically generated by KwaMoja') . "\n";
     $EmailText .= _('You are invited to Tender for the following products to be delivered to') . ' ' . $_SESSION['CompanyRecord']['coyname'] . "\n";
     $EmailText .= _('Tender number') . ': ' . $this->TenderId . "\n";
     $EmailText .= _(' Quantity ') . ' ' . _(' Unit ') . ' ' . _(' Item Description') . "\n";
     foreach ($this->LineItems as $LineItem) {
         $EmailText .= $LineItem->Quantity . ' ' . $LineItem->Units . ' ' . $LineItem->ItemDescription . "\n";
     }
     $Subject = _('Tender received from') . ' ' . $_SESSION['CompanyRecord']['coyname'];
     $Headers = 'From: ' . $_SESSION['PurchasingManagerEmail'] . "\r\n" . 'Reply-To: ' . $_SESSION['PurchasingManagerEmail'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     if ($_SESSION['SmtpSetting'] == 1) {
         include 'includes/htmlMimeMail.php';
         $mail = new htmlMimeMail();
         $mail->setText($EmailText);
         $mail->setSubject($Subject);
         $mail->setFrom($_SESSION['PurchasingManagerEmail']);
         $mail->setHeader('Reply-To', $_SESSION['PurchasingManagerEmail']);
         $mail->setCc($_SESSION['PurchasingManagerEmail']);
         //Set this as a copy for filing purpose
     }
     foreach ($this->Suppliers as $Supplier) {
         $result = mail($Supplier->EmailAddress, $Subject, $EmailText, $Headers);
         if ($_SESSION['SmtpSetting'] == 0) {
             $result = mail($Supplier->EmailAddress, $Subject, $EmailText, $Headers);
         } else {
             $result = SendmailBySmtp($mail, array($Supplier->EmailAddress, $_SESSION['PurchasingManagerEmail']));
         }
     }
 }
 function send($recipients, $type = NULL)
 {
     global $application;
     $mail_settings = modApiFunc("Configuration", "getMailSettings");
     if ($mail_settings['MAIL_TYPE'] != 1 && $mail_settings['MAIL_TYPE'] != 2) {
         $type = 'mail';
     } else {
         $type = $mail_settings['MAIL_TYPE'] == 1 ? 'mail' : 'smtp';
     }
     $res = parent::send($recipients, $type);
     return $res;
 }
Exemplo n.º 4
0
 function m_reviewAdd()
 {
     $this->request['display'] = $this->libFunc->ifSet($this->request, "display");
     $timestamp = time();
     $this->obDb->query = "SELECT iProdid_PK FROM " . PRODUCTS . " WHERE iProdid_PK='" . $this->request['productid'] . "'";
     $rs = $this->obDb->fetchQuery();
     if ($this->obDb->record_count > 0) {
         #inserting to departments
         $this->obDb->query = "SELECT iCustRevid_PK FROM " . REVIEWS . " WHERE iCustomerid_FK='" . $_SESSION['userid'] . "' AND iItemid_FK='" . $this->request['productid'] . "'";
         $rs = $this->obDb->fetchQuery();
         $rsCnt = $this->obDb->record_count;
         if ($rsCnt == 0) {
             $this->obDb->query = "INSERT INTO " . REVIEWS . "\n\t\t\t\t\t\t\t\t\t\t(vTitle,vComment,vRank,iDisplay,iItemid_FK,tmDateAdd,iCustomerid_FK,iState) \n\t\t\t\t\t\t\t\t\t\t\tvalues('" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'{$timestamp}','" . $_SESSION['userid'] . "',1)";
             $this->obDb->updateQuery();
         } else {
             $this->obDb->query = "UPDATE " . REVIEWS . " SET vTitle='" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\tvComment='" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\tvRank='" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\tiDisplay='" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\tiItemid_FK='" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\ttmDateAdd='{$timestamp}' WHERE iCustRevid_PK='" . $rs[0]->iCustRevid_PK . "'";
             $this->obDb->updateQuery();
         }
         # additional functionality to e-mail admin on new submission of new product review - MCB, 26/09/2008
         $this->obDb->query = "SELECT vFirstName, vLastName FROM " . CUSTOMERS . " WHERE iCustmerid_PK=" . $_SESSION['userid'];
         $name_row = $this->obDb->fetchQuery();
         $customername = $name_row[0]->vFirstName . " " . $name_row[0]->vLastName;
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("New product review");
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $message = "Somebody has posted a new product review on your on-line store.<br>Details of this review are listed below.<br><br>";
         $message .= $customername . " submitted the following at " . date('g:ia') . " on " . date('l, d F Y') . ":<br><br>";
         $message .= $this->libFunc->m_displayContent($this->request['comment']) . "<br><br>";
         $message .= "To view this comment, please visit the following URL:<br>";
         $message .= "<a href=\"" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "\">" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "</a>";
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ADMIN_EMAIL)) {
             $result = $obMail->send(array(ADMIN_EMAIL));
         }
     }
     # redirect on posting and e-mailing of comment ...
     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['seotitle']);
     $this->libFunc->m_mosRedirect($retUrl);
     exit;
 }
Exemplo n.º 5
0
function sendHTMLMail($from, $to, $subject, $body)
{
    $mail = new htmlMimeMail();
    $mail->setFrom($from);
    $mail->setSubject($subject);
    $mail->setHTML($body);
    if (is_array($to)) {
        $result = $mail->send($to);
    } else {
        $result = $mail->send(array($to));
    }
    return $result;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 7
0
 function m_sendConfirmation()
 {
     $this->comFunc->obDb = $this->obDb;
     $this->obDb->query = "SELECT vFirstName,vLastName,vEmail  FROM " . ORDERS . " WHERE  iOrderid_PK = '" . $this->request['orderid'] . "'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     //	$uniqID=uniqid (3);
     if ($rCount > 0) {
         $name = $this->libFunc->m_displayContent($qryResult[0]->vFirstName) . " " . $this->libFunc->m_displayContent($qryResult[0]->vLastName);
         $this->ObTpl = new template();
         $this->ObTpl->set_file("TPL_MAIL_FILE", $this->mailTemplate);
         $this->ObTpl->set_var("TPL_VAR_NAME", $name);
         $this->ObTpl->set_var("TPL_VAR_INVOICE", $this->request['invoice']);
         $this->ObTpl->set_var("TPL_VAR_METHOD", $this->request['shipper']);
         $this->ObTpl->set_var("TPL_VAR_TRACKNUM", $this->request['tracking']);
         $orderUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.receipt&mode=" . $this->request['orderid']);
         $this->ObTpl->set_var("TPL_VAR_URL", $orderUrl);
         $this->ObTpl->set_var("TPL_VAR_MAILFOOTER", $this->comFunc->m_mailFooter());
         $message = $this->ObTpl->parse("return", "TPL_MAIL_FILE");
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         #11-05-07
         $obMail->setSubject("Your order from " . SITE_NAME . " has shipped!");
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         $result = $obMail->send(array($qryResult[0]->vEmail));
     }
 }
Exemplo n.º 8
0
             exit;
         }
     }
 }
 //End FPDI Concat
 /*	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'];
Exemplo n.º 9
0
                     break;
                 case 'WH':
                     /* The warehouse keeper details - don't think we care about this either*/
                     break;
             }
             break;
             /*end of NAD segment */
             /* UP TO HERE NEED TESTER */
     }
     /*end case  Seg Tag*/
 }
 /*end while get next line of message */
 /*Thats the end of the message or had to abort */
 if (mb_strlen($EmailText) > 10) {
     /*Now send the email off to the appropriate person */
     $mail = new htmlMimeMail();
     $mail->setText($EmailText);
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
     if ($TryNextFile == True) {
         /*had to abort this message */
         /* send the email to the sysadmin  - get email address from users*/
         $Result = DB_query("SELECT realname, email FROM www_users WHERE fullaccess=7 AND email <>''", $db);
         if (DB_num_rows($Result) == 0) {
             /*There are no sysadmins with email address specified */
             $Recipients = array("'tim' <tim@localhost>");
         } else {
             /*Make an array of the sysadmin recipients */
             $Recipients = array();
             $i = 0;
             while ($SysAdminsRow = DB_fetch_array($Result)) {
                 $Recipients[$i] = "'" . $SysAdminsRow['realname'] . "' <" . $SysAdminsRow['email'] . ">";
Exemplo n.º 10
0
     $LeftOvers = $pdf->addTextWrap($FormDesign->OrderTotal->x, $Page_Height - $FormDesign->OrderTotal->y, $FormDesign->OrderTotal->Length, $FormDesign->OrderTotal->FontSize, $DisplayOrderTotal, 'right');
 }
 /*end if there are order details to show on the order*/
 //} /* end of check to see that there was an order selected to print */
 $Success = 1;
 //assume the best and email goes - has to be set to 1 to allow update status
 if ($MakePDFThenDisplayIt) {
     $pdf->OutputD($_SESSION['DatabaseName'] . '_PurchaseOrder_' . $OrderNo . '_' . date('Y-m-d') . '.pdf');
     $pdf->__destruct();
 } else {
     /* must be MakingPDF to email it */
     $PdfFileName = $_SESSION['DatabaseName'] . '_PurchaseOrder_' . $OrderNo . '_' . date('Y-m-d') . '.pdf';
     $pdf->Output($_SESSION['reports_dir'] . '/' . $PdfFileName, 'F');
     $pdf->__destruct();
     include 'includes/htmlMimeMail.php';
     $mail = new htmlMimeMail();
     $attachment = $mail->getFile($_SESSION['reports_dir'] . '/' . $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'] . '>');
     $Success = $mail->send(array($_POST['EmailTo']));
     if ($Success == 1) {
         $title = _('Email a Purchase Order');
         include 'includes/header.inc';
         echo '<div class="centre"><br /><br /><br />';
         prnMsg(_('Purchase Order') . ' ' . $OrderNo . ' ' . _('has been emailed to') . ' ' . $_POST['EmailTo'] . ' ' . _('as directed'), 'success');
     } else {
         //email failed
         $title = _('Email a Purchase Order');
         include 'includes/header.inc';
Exemplo n.º 11
0
The configuration of this script requires the id of the sales analysis report to send
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'] . '>');
Exemplo n.º 12
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);
}
 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;
 }
Exemplo n.º 14
0
/**
 * Send e-mails
 *
 * @param String $to      Recipient mail address
 * @param String $subject Subject
 * @param String $message Mail content
 * @param String $from    Sender mail address
 * @param Array  $headers Additional mail headers
 *
 * @return Bool Returs true if mail has been sent
 */
function send_mail($to, $subject, $message, $from, $headers = NULL)
{
    global $configuration;
    $mail = new htmlMimeMail();
    if ($configuration['mail_type'] == 'smtp') {
        $type = 'smtp';
        $smtp = $configuration['smtp'];
        $mail->setSMTPParams($smtp['host'], $smtp['port'], $smtp['helo'], $smtp['auth'], $smtp['user'], $smtp['pass']);
    } else {
        $type = 'mail';
    }
    // Set additional mail headers
    $html = false;
    if (is_array($headers)) {
        foreach ($headers as $name => $value) {
            $mail->setHeader($name, $value);
            if (strtolower($name) == 'content-type' and preg_match('#text/html#i', $value)) {
                $mail->setHtmlCharset($configuration['character_set']);
                $mail->setHtml($message);
                $html = true;
            }
            // Set return path
            if (strtolower($name) == 'return-path') {
                $mail->setReturnPath($value);
            }
        }
    }
    $mail->setHeadCharset($configuration['character_set']);
    $mail->setFrom($from);
    $mail->setSubject($subject);
    if ($html != true) {
        $configuration['character_set'];
        $mail->setTextCharset($configuration['character_set']);
        $mail->setText($message);
    }
    $result = $mail->send(array($to), $type);
    if ($result) {
        return true;
    }
}
Exemplo n.º 15
0
 function subscriber_sendspam()
 {
     if (!$this->haveAccessTo('sendspam-subscribers')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     $aSelectedEmails = func::POSTGET('user_id', false);
     if (is_array($aSelectedEmails)) {
         $aSelectedEmails = array_unique($aSelectedEmails);
     }
     $sFrom = self::SENDSPAM_FROM;
     if (func::isPostMethod() || func::POSTGET('submit') == 'send') {
         $sSubject = func::POSTGET('subject', true);
         $sBody = func::POSTGET('body', true);
         if (!$sSubject) {
             $this->errors->set('no_subject');
         }
         if (!$sBody) {
             $this->errors->set('no_body');
         }
         if (!is_array($aSelectedEmails) || count($aSelectedEmails) == 0) {
             $this->errors->set('no_receivers');
         }
         if ($this->errors->no()) {
             include PATH_CORE . 'mail/htmlMimeMail.php';
             @set_time_limit(0);
             $nCountSuccessfull = 0;
             $nCountUnsuccessfull = 0;
             $aEmailsSuccessfull = array();
             $oMail = new htmlMimeMail();
             $oMail->setSubject($sSubject);
             $oMail->setFrom($sFrom);
             $oMail->setText($sBody);
             for ($i = 0; $i < count($aSelectedEmails); $i++) {
                 if (@$oMail->send(array($aSelectedEmails[$i]))) {
                     $nCountSuccessfull++;
                     $aEmailsSuccessfull[] = $aSelectedEmails[$i];
                 } else {
                     $nCountUnsuccessfull++;
                 }
             }
             if ($nCountUnsuccessfull == 0) {
                 $this->adminRedirect(Errors::SUCCESSFULL, 'subscriber_sendspam');
             } else {
                 $this->errors->set('result_of_sendmail', false, 'успешно - ' . $nCountSuccessfull . ' / с ошибками - ' . $nCountUnsuccessfull);
                 //leave only unsuccessfull emails :)
                 $aSelectedEmails = array_diff($aSelectedEmails, $aEmailsSuccessfull);
             }
         }
         $aData = $_REQUEST;
     }
     $aSubscribers = $this->db->select('SELECT id, email, name FROM ' . DB_PREFIX . 'subscribers ORDER BY name');
     $htmlExistsOptions = '';
     $htmlReceiversOptions = '';
     for ($i = 0; $i < count($aSubscribers); $i++) {
         if (!$aSubscribers[$i]['email']) {
             continue;
         }
         $htmlItem = '<option value="' . $aSubscribers[$i]['email'] . '">' . $aSubscribers[$i]['name'] . ' &lt;' . $aSubscribers[$i]['email'] . '&gt; </option>';
         if (is_array($aSelectedEmails) && in_array($aSubscribers[$i]['email'], $aSelectedEmails)) {
             $htmlReceiversOptions .= $htmlItem;
         } else {
             $htmlExistsOptions .= $htmlItem;
         }
     }
     $aData['from'] = $sFrom;
     $this->tplAssign('aData', $aData);
     $this->tplAssign("exists_values", $htmlExistsOptions);
     $this->tplAssign("sendtousers_options", $htmlReceiversOptions);
     return $this->tplFetch('admin.subscriber.sendspam.tpl');
 }
Exemplo n.º 16
0
 function m_sendPassword()
 {
     $this->obDb->query = "select iCustmerid_PK,vFirstName,vEmail,tmSignupDate FROM " . CUSTOMERS . " WHERE vEmail = '" . $this->request['email'] . "' AND iRegistered='1'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     if (isset($this->cart)) {
         $action = "ecom/index.php?action=checkout.loginForm";
     } else {
         $action = "user/index.php?action=user.loginForm";
     }
     if ($rCount > 0) {
         $requesttime = time();
         $recoveryid = md5($qryResult[0]->iCustmerid_PK . $qryResult[0]->vFirstName . $qryResult[0]->vEmail . $qryResult[0]->tmSignupDate . $requesttime);
         $this->obDb->query = "UPDATE " . CUSTOMERS . " SET vRecovery='" . $recoveryid . "',tRequestTime='" . $requesttime . "' WHERE iCustmerid_PK='" . $qryResult[0]->iCustmerid_PK . "' AND iRegistered='1'";
         $this->obDb->updateQuery();
         //	$uniqID=uniqid (3);
         $message = "Hi " . $this->libFunc->m_displayContent($qryResult[0]->vFirstName);
         $message .= "<br><br>You requested to reset your login details for Username:&nbsp;" . $qryResult[0]->vEmail;
         $message .= "<br><br>You can do so by visiting this <a href='" . SITE_URL . "user/index.php?action=user.recover&id=" . $recoveryid . "'>link</a>.";
         $message .= "<br>If the link is not clickable, copy and paste this url into your browser: " . SITE_URL . "user/index.php?action=user.recover&id=" . $recoveryid;
         $message .= "<br>You must click the above password within 24 hours of your request or the link will be deactivated.";
         $message .= "<br><br>If you didn't request to reset your password, then please disregard this message.";
         $message .= "<br><br>Best Regards,";
         $message .= "<br><a href='" . SITE_URL . "'>" . SITE_NAME . "</a>";
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("Login details from " . SITE_NAME);
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         $result = $obMail->send(array($qryResult[0]->vEmail));
         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . $action . "&mode=sent&msg=1");
         $this->libFunc->m_mosRedirect($retUrl);
         exit;
     } else {
         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . $action . "&mode=lost&msg=2");
         $this->libFunc->m_mosRedirect($retUrl);
         exit;
     }
 }
            $SQLScript .= "INSERT INTO taxprovinces (taxprovinceid,\n                                                    taxprovincename)\n                                   VALUES (" . $TaxProvincesRow['taxprovinceid'] . ",\n                                          '" . $TaxProvincesRow['taxprovincename'] . "');\n";
        }
        /*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*/
}
Exemplo n.º 18
0
}elseif (isset($_COOKIE["reachlocal"])){

$messageSubject = "Erie Institute of Technology - Welding Landing Page - Online Request - $first_name $last_name";



	

} else {

$messageSubject = "Erie Institute of Technology - Welding Landing Page - Online Request - $first_name $last_name";

}

			$mail = new htmlMimeMail();



			$mail->setHtml($body, $body_notags);

			

			$mail->setReturnPath('*****@*****.**');



			$mail->setFrom('*****@*****.**');


Exemplo n.º 19
0
     } else {
         prnMsg(_('The accepted offers from') . ' ' . $SupplierName . ' ' . _('have been converted to purcharse orders but failed to mail, you can view the order contents') . ' ' . '<a href="' . $RootPath . '/PO_Header.php?ModifyOrderNumber=' . $OrderNo . '">' . _('here') . '</a>', 'warn');
     }
 }
 if (sizeOf($RejectsArray) > 0) {
     $MailText = _('This email has been automatically generated by the webERP installation at') . ' ' . $_SESSION['CompanyRecord']['coyname'] . "\n";
     $MailText .= _('The following offers you made have been rejected') . "\n\n";
     foreach ($RejectsArray as $RejectID) {
         $sql = "SELECT offers.quantity,\n\t\t\t\t\t\t\toffers.price,\n\t\t\t\t\t\t\tstockmaster.description\n\t\t\t\t\t\tFROM offers\n\t\t\t\t\t\tLEFT JOIN stockmaster\n\t\t\t\t\t\t\tON offers.stockid=stockmaster.stockid\n\t\t\t\t\t\tWHERE offerid='" . $RejectID . "'";
         $result = DB_query($sql);
         $myrow = DB_fetch_array($result);
         $MailText .= $myrow['description'] . "\t" . _('Quantity') . ' ' . $myrow['quantity'] . "\t" . _('Price') . ' ' . locale_number_format($myrow['price']) . "\n";
         $sql = "DELETE FROM offers WHERE offerid='" . $RejectID . "'";
         $result = DB_query($sql);
     }
     $mail = new htmlMimeMail();
     $mail->setSubject(_('Your offer to') . ' ' . $_SESSION['CompanyRecord']['coyname'] . ' ' . _('has been rejected'));
     $mail->setText($MailText);
     $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
     $Recipients = GetMailList('OffersReceivedResultRecipients');
     if (sizeOf($Recipients) == 0) {
         prnMsg(_('There are no members of the Offers Received Result Recipients email group'), 'warn');
         include 'includes/footer.inc';
         exit;
     }
     array_push($Recipients, $Email);
     if ($_SESSION['SmtpSetting'] == 0) {
         $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>');
         $result = $mail->send($Recipients);
     } else {
         $result = SendmailBySmtp($mail, $Recipients);
Exemplo n.º 20
0
function welcome_email_send(&$registration_details)
{
    global $main_smarty, $current_user;
    include_once mnminclude . 'user.php';
    // Check User ID != 0
    if ($registration_details['id'] > 0) {
        $username = $registration_details['username'];
        $password = $registration_details['password'];
        $email = $registration_details['email'];
        $id = $registration_details['id'];
        $user = new User();
        $user->id = $id;
        // Check User Data
        if ($user->read()) {
            include_once mnmmodules . 'welcome_email/includes/htmlMimeMail.php';
            // Current Date/Time of Server
            $thisDate = date("M d, Y");
            $thisTime = date("H:i:s");
            // User Information
            $thisUserName = $username;
            $thisUserEmail = $email;
            // Pligg Information
            $siteName = $main_smarty->get_config_vars('PLIGG_Visual_Name');
            $siteEmail = $main_smarty->get_config_vars('PLIGG_PassEmail_From');
            $installedURL = my_base_url;
            $installedBase = my_pligg_base;
            // Email Subject
            $messageSubject = "Welcome to " . $siteName . "!";
            // Email Message
            $messageText = "Hello, " . $thisUserName . ".\n\n";
            $messageText .= "Your account at " . $siteName . " has been successfully set up.\n\n";
            $messageText .= "Please keep the below information for future reference:\n";
            $messageText .= "-----------------------------------------\n\n";
            $messageText .= "  Login URL: " . $installedURL . $installedBase . "/login.php\n\n";
            $messageText .= "  Username.: " . $thisUserName . "\n";
            $messageText .= "  Password.: (password choosen when registered)\n\n";
            $messageText .= "-----------------------------------------\n";
            $messageText .= "Email has been automatically generated on " . $thisDate . " at " . $thisTime . ".\n";
            // Setup Mail Class
            $mail = new htmlMimeMail();
            // Set Mail Body Text
            $mail->setText($messageText);
            // Set Mail From
            $mail->setFrom($siteName . " <" . $siteEmail . ">");
            // Set Mail Subject
            $mail->setSubject($messageSubject);
            // Send Mail
            $mail->send(array($thisUserEmail));
        } else {
            // Unable to find user data
            echo "Module Error #2";
            die;
            // To disable this error message and continue with registration,
            // remove the above ELSE statement this comment is within.
        }
    } else {
        // Unable to find User ID
        echo "Module Error #1";
        die;
    }
}
Exemplo n.º 21
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();
Exemplo n.º 22
0
  }

  $cSql = "SELECT "
        . "  NwsSuscCodigo, NwsSuscNombre, NwsSuscMail "
        . "FROM NwsSuscriptores "
        . "WHERE " . $cFiltro . " "
        . "LIMIT " . $nCuantos ;
  $nResultado = mysql_query ($cSql) or fErrorSQL($conf["EstadoSitio"], "<br /><br /><b>Error en la consulta:</b><br />" . $cSql . "<br /><br /><b>Tipo de error:</b><br />" . mysql_error() . "<br />");

  $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);
        foreach ($_SESSION['Request']->LineItems as $LineItems) {
            $LineSQL = "INSERT INTO stockrequestitems (dispatchitemsid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdispatchid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdecimalplaces,\n\t\t\t\t\t\t\t\t\t\t\t\t\tuom)\n\t\t\t\t\t\t\t\t\t\t\t\tVALUES(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->LineNumber . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $RequestNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->StockID . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->Quantity . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->DecimalPlaces . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->UOM . "')";
            $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The request line record could not be inserted because');
            $DbgMsg = _('The following SQL to insert the request header record was used');
            $Result = DB_query($LineSQL, $ErrMsg, $DbgMsg, true);
        }
        $EmailSQL = "SELECT email\n\t\t\t\t\tFROM www_users, departments\n\t\t\t\t\tWHERE departments.authoriser = www_users.userid\n\t\t\t\t\t\tAND departments.departmentid = '" . $_SESSION['Request']->Department . "'";
        $EmailResult = DB_query($EmailSQL);
        if ($myEmail = DB_fetch_array($EmailResult)) {
            $ConfirmationText = _('An internal stock request has been created and is waiting for your authoritation');
            $EmailSubject = _('Internal Stock Request needs your authoritation');
            if ($_SESSION['SmtpSetting'] == 0) {
                mail($myEmail['email'], $EmailSubject, $ConfirmationText);
            } else {
                include 'includes/htmlMimeMail.php';
                $mail = new htmlMimeMail();
                $mail->setSubject($EmailSubject);
                $mail->setText($ConfirmationText);
                $result = SendmailBySmtp($mail, array($myEmail['email']));
            }
        }
    }
    DB_Txn_Commit();
    prnMsg(_('The internal stock request has been entered and now needs to be authorised'), 'success');
    echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?New=Yes">' . _('Create another request') . '</a></div>';
    include 'includes/footer.inc';
    unset($_SESSION['Request']);
    exit;
}
echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/supplier.png" title="' . _('Dispatch') . '" alt="" />' . ' ' . $Title . '</p>';
if (isset($_GET['Edit'])) {
Exemplo n.º 24
0
}
// change directory to the kwamoja home to get all the includes to work nicely
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'] . ">");
    $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);
}
Exemplo n.º 26
0
* Filename.......: example.1.php
* Project........: HTML Mime Mail class
* Last Modified..: 15 July 2002
*/
error_reporting(E_ALL);
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');
        $DbgMsg = _('The following SQL to insert the debtor transaction record was used');
        $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
        $DebtorTransID = DB_Last_Insert_ID($db, 'debtortrans', 'id');
        $SQL = 'INSERT INTO debtortranstaxes (debtortransid,
							taxauthid,
							taxamount)
				VALUES (' . $DebtorTransID . ',
					' . $TaxAuthID . ',
					' . $Tax['FXAmount'] / $CurrencyRate . ')';
        $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because');
        $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used');
        $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
        $SQL = 'COMMIT';
        $Result = DB_query($SQL, $db);
        echo _('Invoice number') . ' ' . $InvoiceNo . ' ' . _('processed') . '<BR>';
        $EmailText .= "\n" . _('This recurring order was set to produce the invoice automatically on invoice number') . ' ' . $InvoiceNo;
    }
    /*end if the recurring order is set to auto invoice */
    if (IsEmailAddress($RecurrOrderRow['email'])) {
        $mail = new htmlMimeMail();
        $mail->setText($EmailText);
        $mail->setSubject(_('Recurring Order Created Advice'));
        $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
        $result = $mail->send(array($RecurrOrderRow['email']));
        unset($mail);
    } else {
        prnMsg(_('No email advice was sent for this order because the location has no email contact defined with a valid email address'), 'warn');
    }
}
/*end while there are recurring orders due to have a new order created */
include 'includes/footer.inc';
Exemplo n.º 28
0
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;
    }
}
Exemplo n.º 29
0
     }
     if ($Quantity >= $RequestedQuantity or $Completed == True) {
         $SQL = "UPDATE stockrequestitems\n\t\t\t\t\t\t\t\tSET completed=1\n\t\t\t\t\t\t\tWHERE dispatchid='" . $RequestID . "'\n\t\t\t\t\t\t\t\tAND dispatchitemsid='" . $LineID . "'";
         $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
     }
     $Result = DB_Txn_Commit($db);
     $ConfirmationText = _('An internal stock request for') . ' ' . $StockID . ' ' . _('has been fulfilled from location') . ' ' . $Location . ' ' . _('for a quantity of') . ' ' . locale_number_format($Quantity, $DecimalPlaces);
     prnMsg($ConfirmationText, 'success');
     if ($_SESSION['InventoryManagerEmail'] != '') {
         $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s');
         $EmailSubject = _('Internal Stock Request Fulfillment for') . ' ' . $StockID;
         if ($_SESSION['SmtpSetting'] == 0) {
             mail($_SESSION['InventoryManagerEmail'], $EmailSubject, $ConfirmationText);
         } else {
             include 'includes/htmlMimeMail.php';
             $mail = new htmlMimeMail();
             $mail->setSubject($EmailSubject);
             $mail->setText($ConfirmationText);
             $result = SendmailBySmtp($mail, array($_SESSION['InventoryManagerEmail']));
         }
     }
 } else {
     $ConfirmationText = _('An internal stock request for') . ' ' . $StockID . ' ' . _('has been fulfilled from location') . ' ' . $Location . ' ' . _('for a quantity of') . ' ' . locale_number_format($Quantity, $DecimalPlaces) . ' ' . _('cannot be created as there is insufficient stock and your system is configured to not allow negative stocks');
     prnMsg($ConfirmationText, 'warn');
 }
 // Check if request can be closed and close if done.
 if (isset($RequestID)) {
     $SQL = "SELECT dispatchid\n\t\t\t\t\t\tFROM stockrequestitems\n\t\t\t\t\t\tWHERE dispatchid='" . $RequestID . "'\n\t\t\t\t\t\t\tAND completed=0";
     $Result = DB_query($SQL, $db);
     if (DB_num_rows($Result) == 0) {
         $SQL = "UPDATE stockrequest\n\t\t\t\t\t\tSET closed=1\n\t\t\t\t\tWHERE dispatchid='" . $RequestID . "'";
Exemplo n.º 30
0
                     }
                 }
                 //end loop around creation of woserialnos
                 $NewNextSerialNo = $StockItem->NextSerialNo + $WOQuantity + 1;
                 $ErrMsg = _('Could not update the new next serial number for the item');
                 $UpdateSQL = "UPDATE stockmaster SET nextserialno='" . $NewNextSerialNo . "' WHERE stockid='" . $StockItem->StockID . "'";
                 $UpdateNextSerialNoResult = DB_query($UpdateSQL, $db, $ErrMsg, $DbgMsg, true);
             }
             // end if the item is serialised and nextserialno is set
             $EmailSubject = _('New Work Order Number') . ' ' . $WONo . ' ' . _('for') . ' ' . $StockItem->StockID . ' x ' . $WOQuantity;
             //Send email to the Factory Manager
             if ($_SESSION['SmtpSetting'] == 0) {
                 mail($_SESSION['FactoryManagerEmail'], $EmailSubject, $FactoryManagerEmail);
             } else {
                 include 'includes/htmlMimeMail.php';
                 $mail = new htmlMimeMail();
                 $mail->setSubject($EmailSubject);
                 $result = SendmailBySmtp($mail, array($_SESSION['FactoryManagerEmail']));
             }
         }
         //end if with this sales order there is a shortfall of stock - need to create the WO
     }
     //end if auto create WOs in on
 }
 /* end inserted line items into sales order details */
 prnMsg(_('Order Number') . ' ' . $OrderNo . ' ' . _('has been entered'), 'success');
 /* End of insertion of new sales order */
 /*Now Get the next invoice number - GetNextTransNo() function in SQL_CommonFunctions
  * GetPeriod() in includes/DateFunctions.inc */
 $DefaultDispatchDate = Date('Y-m-d');
 /*Update order header for invoice charged on */