本文整理汇总了PHP中CMailFile类 的典型用法代码示例。如果您正苦于以下问题:PHP CMailFile类的具体用法?PHP CMailFile怎么用?PHP CMailFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMailFile类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: send
/**
* \brief Check if notification are active for couple action/company.
* If yes, send mail and save trace into llx_notify.
* \param action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
* \param socid Id of third party
* \param texte Message to send
* \param objet_type Type of object the notification deals on (facture, order, propal, order_supplier...). Just for log in llx_notify.
* \param objet_id Id of object the notification deals on
* \param file Attach a file
* \return int <0 if KO, or number of changes if OK
*/
function send($action, $socid, $texte, $objet_type, $objet_id, $file = "")
{
global $conf, $langs, $mysoc, $dolibarr_main_url_root;
$langs->load("other");
dol_syslog("Notify::send action={$action}, socid={$socid}, texte={$texte}, objet_type={$objet_type}, objet_id={$objet_id}, file={$file}");
$sql = "SELECT s.nom, c.email, c.rowid as cid, c.name, c.firstname,";
$sql .= " a.rowid as adid, a.label, a.code, n.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c,";
$sql .= " " . MAIN_DB_PREFIX . "c_action_trigger as a,";
$sql .= " " . MAIN_DB_PREFIX . "notify_def as n,";
$sql .= " " . MAIN_DB_PREFIX . "societe as s";
$sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.rowid";
if (is_numeric($action)) {
$sql .= " AND n.fk_action = " . $action;
} else {
$sql .= " AND a.code = '" . $action . "'";
}
// New usage
$sql .= " AND s.rowid = " . $socid;
dol_syslog("Notify::send sql=" . $sql);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($result);
$sendto = $obj->firstname . " " . $obj->name . " <" . $obj->email . ">";
$actiondefid = $obj->adid;
if (dol_strlen($sendto)) {
include_once DOL_DOCUMENT_ROOT . '/lib/files.lib.php';
$application = $conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM';
$subject = '[' . $application . '] ' . $langs->transnoentitiesnoconv("DolibarrNotification");
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name) . "\n";
$message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name) . "\n";
$message .= "\n";
$message .= $texte;
// Add link
switch ($objet_type) {
case 'ficheinter':
$link = DOL_URL_ROOT . '/fichinter/fiche.php?id=' . $objet_id;
break;
case 'propal':
$link = DOL_URL_ROOT . '/comm/propal.php?id=' . $objet_id;
break;
case 'facture':
$link = DOL_URL_ROOT . '/compta/facture.php?facid=' . $objet_id;
break;
case 'order':
$link = DOL_URL_ROOT . '/commande/fiche.php?facid=' . $objet_id;
break;
case 'order_supplier':
$link = DOL_URL_ROOT . '/fourn/commande/fiche.php?facid=' . $objet_id;
break;
}
$urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', $dolibarr_main_url_root);
if ($link) {
$message .= "\n" . $urlwithouturlroot . $link;
}
$filename = basename($file);
$mimefile = dol_mimetype($file);
$msgishtml = 0;
$replyto = $conf->notification->email_from;
$mailfile = new CMailFile($subject, $sendto, $replyto, $message, array($file), array($mimefile), array($filename[sizeof($filename) - 1]), '', '', 0, $msgishtml);
if ($mailfile->sendfile()) {
$sendto = htmlentities($sendto);
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify (daten, fk_action, fk_contact, objet_type, objet_id, email)";
$sql .= " VALUES (" . $this->db->idate(mktime()) . ", " . $actiondefid . " ," . $obj->cid . " , '" . $objet_type . "', " . $objet_id . ", '" . $this->db->escape($obj->email) . "')";
dol_syslog("Notify::send sql=" . $sql);
if (!$this->db->query($sql)) {
dol_print_error($this->db);
}
} else {
$this->error = $mailfile->error;
//dol_syslog("Notify::send ".$this->error, LOG_ERR);
}
}
$i++;
}
return $i;
} else {
$this->error = $this->db->error();
return -1;
}
}
开发者ID:netors, 项目名称:dolibarr, 代码行数:96, 代码来源:notify.class.php
示例2: array
$TSearch = $TVal = array();
foreach ($propal->thirdparty as $attr => $val) {
if (!is_array($val) && !is_object($val)) {
$TSearch[] = $prefix . $attr;
$TVal[] = $val;
}
}
//Changement de méthode (pas de str_replace) pour éviter les collisions. Exemple avec __PROPAL_ref et __PROPAL_ref_client
foreach ($TSearchPropal as $i => $propal_value) {
$msg = preg_replace('/' . $propal_value . '\\b/', $TValPropal[$i], $msg);
}
$msg = preg_replace('/__SIGNATURE__\\b/', $newUser->signature, $msg);
$msg = str_replace($TSearch, $TVal, $msg);
$TMail[] = $mail;
// Construct mail
$CMail = new CMailFile($subject, $mail, $conf->global->MAIN_MAIL_EMAIL_FROM, $msg, $filename_list, $mimetype_list, $mimefilename_list, '', '', '', $msgishtml, $conf->global->MAIN_MAIL_ERRORS_TO);
// Send mail
$CMail->sendfile();
if ($CMail->error) {
$TErrorMail[] = $CMail->error;
} else {
_createEvent($db, $user, $langs, $conf, $propal, 0, $conf->global->PROPALAUTOSEND_MSG_SUBJECT, $msg);
}
}
}
}
}
echo "liste des mails ok : ";
var_dump($TMail);
echo "<br />liste des mails en erreur : ";
var_dump($TErrorMail);
开发者ID:ATM-Consulting, 项目名称:dolibarr_module_propalautosend, 代码行数:31, 代码来源:propalAutoSend.php
示例3: User
$expediteur = new User($db);
$expediteur->fetch($user->id);
$emailFrom = $expediteur->email;
// SUBJECT
$subject = "'ERP - Note de frais payée";
// CONTENT
$message = "Bonjour {$destinataire->firstname},\n\n";
$message .= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n";
$message .= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
$message .= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
$message .= "Bien cordialement,\n' SI";
// Generate pdf before attachment
$object->setDocModel($user, "");
$resultPDF = expensereport_pdf_create($db, $object, '', "", $langs);
// PREPARE SEND
$mailfile = new CMailFile($subject, $emailTo, $emailFrom, $message);
if (!$mailfile->error) {
// SEND
$result = $mailfile->sendfile();
if ($result) {
// Retour
if ($result) {
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
} else {
dol_print_error($db);
}
} else {
dol_print_error($db, $acct->error);
}
} else {
开发者ID:Samara94, 项目名称:dolibarr, 代码行数:31, 代码来源:card.php
示例4: envoi_mail
/**
* Send email
*
* @param string $mode Mode (test | confirm)
* @param string $oldemail Old email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @param string $userlang Code lang to use for email output.
* @param string $oldsalerepresentative Old sale representative
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepresentative)
{
global $conf, $langs;
if (getenv('DOL_FORCE_EMAIL_TO')) {
$oldemail = getenv('DOL_FORCE_EMAIL_TO');
}
$newlangs = new Translate('', $conf);
$newlangs->setDefaultLang(empty($userlang) ? empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT : $userlang);
$newlangs->load("main");
$newlangs->load("bills");
$subject = empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_SUBJECT) ? $newlangs->trans("ListOfYourUnpaidInvoices") : $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_SUBJECT;
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = -1;
print "- Send email for " . $oldsalerepresentative . " (" . $oldemail . "), total: " . $total . "\n";
dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to " . $oldemail);
$usehtml = 0;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) {
$usehtml += 1;
}
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER)) {
$usehtml += 1;
}
$allmessage = '';
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER;
} else {
$allmessage .= $newlangs->transnoentities("ListOfYourUnpaidInvoices") . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices") . ($usehtml ? "<br>\n" : "\n");
}
$allmessage .= $message . ($usehtml ? "<br>\n" : "\n");
$allmessage .= $langs->trans("Total") . " = " . price($total, 0, $newlangs, 0, 0, -1, $conf->currency) . ($usehtml ? "<br>\n" : "\n");
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) {
$usehtml += 1;
}
}
$mail = new CMailFile($subject, $sendto, $from, $allmessage, array(), array(), array(), '', '', 0, $msgishtml);
$mail->errors_to = $errorsto;
// Send or not email
if ($mode == 'confirm') {
$result = $mail->sendfile();
if (!$result) {
print "Error sending email " . $mail->error . "\n";
dol_syslog("Error sending email " . $mail->error . "\n");
}
} else {
print "No email sent (test mode)\n";
dol_syslog("No email sent (test mode)");
$mail->dump_mail();
$result = 1;
}
if ($result) {
return 1;
} else {
return -1;
}
}
开发者ID:ADDAdev, 项目名称:Dolibarr, 代码行数:71, 代码来源:email_unpaid_invoices_to_representatives.php
示例5: dol_dir_list
if (!empty($object->bgcolor)) {
$arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor) ? '' : '#') . $object->bgcolor;
}
if (!empty($object->bgimage)) {
$arr_css['bgimage'] = $object->bgimage;
}
// Attached files
$listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$arr_file[] = $listofpaths[$key]['fullname'];
$arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
$arr_name[] = $listofpaths[$key]['name'];
}
}
$mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css);
$result = $mailfile->sendfile();
if ($result) {
$mesg = '<div class="ok">' . $langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)) . '</div>';
} else {
$mesg = '<div class="error">' . $langs->trans("ResultKo") . '<br>' . $mailfile->error . ' ' . $result . '</div>';
}
$action = '';
}
}
// Action add emailing
if ($action == 'add') {
$object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]);
$object->titre = trim($_POST["titre"]);
开发者ID:LionSystemsSolutions, 项目名称:El-Canelo-ERP, 代码行数:31, 代码来源:fiche.php
示例6: sendMail
/**
* Send mail with ticket data
* @param $email
* @return int <0 if KO; >0 if OK
*/
public static function sendMail($email)
{
global $db, $conf, $langs;
$function = "sendMail";
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
if ($email["idTicket"]) {
$ticket = new Ticket($db);
$ticket->fetch($email["idTicket"]);
$subject = $conf->global->MAIN_INFO_SOCIETE_NOM . ': ' . $langs->trans("CopyOfTicket") . ' ' . $ticket->ticketnumber;
$message = self::FillMailTicketBody($ticket->id);
}
if ($email["idFacture"]) {
$facture = new Facture($db);
$facture->fetch($email["idFacture"]);
$subject = $conf->global->MAIN_INFO_SOCIETE_NOM . ': ' . $langs->trans("CopyOfFacture") . ' ' . $facture->ref;
$message = self::FillMailFactureBody($facture->id);
}
if ($email["idCloseCash"]) {
$subject = $conf->global->MAIN_INFO_SOCIETE_NOM . ': ' . $langs->trans("CopyOfCloseCash") . ' ' . $email["idCloseCash"];
$message = self::FillMailCloseCashBody($email["idCloseCash"]);
}
$from = $conf->global->MAIN_INFO_SOCIETE_NOM . "<" . $conf->global->MAIN_INFO_SOCIETE_MAIL . ">";
$mailfile = new CMailFile($subject, $email["mail_to"], $from, $message);
if ($mailfile->error) {
$mesg = '<div class="error">' . $mailfile->error . '</div>';
$res = -1;
} else {
$res = $mailfile->sendfile();
}
return ErrorControl($res, $function);
}
开发者ID:LionSystemsSolutions, 项目名称:El-Canelo-ERP, 代码行数:36, 代码来源:pos.class.mañanero.php
示例7: testCMailFileStatic
/**
* testCMailFileStatic
*
* @return string
*/
public function testCMailFileStatic()
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject = new CMailFile('', '', '', '');
$src = 'John Doe <[email protected] >';
$result = $localobject->getValidAddress($src, 0);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals($result, 'John Doe <[email protected] >');
$src = 'John Doe <[email protected] >';
$result = $localobject->getValidAddress($src, 1);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals($result, '<[email protected] >');
$src = 'John Doe <[email protected] >';
$result = $localobject->getValidAddress($src, 2);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals($result, '[email protected] ');
$src = 'John Doe <[email protected] >';
$result = $localobject->getValidAddress($src, 3, 0);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals($result, '"John Doe" <[email protected] >');
$src = 'John Doe <[email protected] >';
$result = $localobject->getValidAddress($src, 3, 1);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals($result, '"=?UTF-8?B?Sm9obiBEb2U=?=" <[email protected] >');
return $result;
}
开发者ID:Samara94, 项目名称:dolibarr, 代码行数:35, 代码来源:CMailFileTest.php
示例8: include_once
}
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
// Create form object
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db);
$attachedfiles=$formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
// Envoi de la propal
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->error)
{
$mesg='<div class="error">'.$mailfile->error.'</div>';
}
else
{
$result=$mailfile->sendfile();
if ($result)
{
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'.</div>';
$error=0;
// Initialisation donnees
$object->sendtoid = $sendtoid;
开发者ID:remyyounes, 项目名称:dolibarr, 代码行数:31, 代码来源:fiche.php
示例9: envoi_mail
/**
* Send email
*
* @param string $mode Mode (test | confirm)
* @param string $oldemail Target email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @param string $userlang Code lang to use for email output.
* @param string $oldtarget Target name
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
{
global $conf, $langs;
if (getenv('DOL_FORCE_EMAIL_TO')) {
$oldemail = getenv('DOL_FORCE_EMAIL_TO');
}
$newlangs = new Translate('', $conf);
$newlangs->setDefaultLang(empty($userlang) ? empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT : $userlang);
$newlangs->load("main");
$newlangs->load("bills");
$subject = empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT) ? $newlangs->trans("ListOfYourUnpaidInvoices") : $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT;
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = -1;
print "- Send email to '" . $oldtarget . "' (" . $oldemail . "), total: " . $total . "\n";
dol_syslog("email_unpaid_invoices_to_customers.php: send mail to " . $oldemail);
$usehtml = 0;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) {
$usehtml += 1;
}
$allmessage = '';
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER;
} else {
$allmessage .= "Dear customer" . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= "Please, find a summary of the bills with pending payments from you." . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= "Note: This list contains only unpaid invoices." . ($usehtml ? "<br>\n" : "\n");
}
$allmessage .= $message . ($usehtml ? "<br>\n" : "\n");
$allmessage .= $langs->trans("Total") . " = " . price($total, 0, $userlang, 0, 0, -1, $conf->currency) . ($usehtml ? "<br>\n" : "\n");
if (!empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
}
$mail = new CMailFile($subject, $sendto, $from, $allmessage, array(), array(), array(), '', '', 0, $msgishtml);
$mail->errors_to = $errorsto;
// Send or not email
if ($mode == 'confirm') {
$result = $mail->sendfile();
if (!$result) {
print "Error sending email " . $mail->error . "\n";
dol_syslog("Error sending email " . $mail->error . "\n");
}
} else {
print "No email sent (test mode)\n";
dol_syslog("No email sent (test mode)");
$mail->dump_mail();
$result = 1;
}
unset($newlangs);
if ($result) {
return 1;
} else {
return -1;
}
}
开发者ID:Samara94, 项目名称:dolibarr, 代码行数:73, 代码来源:email_unpaid_invoices_to_customers.php
示例10: envoi_mail
/**
* Send email
*
* @param string $oldemail Old email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($oldemail,$message,$total)
{
global $conf,$langs;
$subject = "[Dolibarr] List of unpaid invoices";
$sendto = $oldemail;
$from = $conf->global->MAIN_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = 0;
print "Envoi mail pour $oldemail, total: $total\n";
dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to $oldemail");
$allmessage = "List of unpaid invoices\n";
$allmessage .= "This list contains only invoices for third parties you are linked to as a sales representative.\n";
$allmessage .= "\n";
$allmessage .= $message;
$allmessage .= "\n";
$allmessage .= $langs->trans("Total")." = ".price($total)."\n";
$mail = new CMailFile(
$subject,
$sendto,
$from,
$allmessage,
array(),
array(),
array(),
'',
'',
0,
$msgishtml
);
$mail->errors_to = $errorsto;
$result=$mail->sendfile();
if ($result)
{
return 1;
}
else
{
return -1;
}
}
开发者ID:nrjacker4, 项目名称:crm-php, 代码行数:54, 代码来源:email_unpaid_invoices_to_representatives.php
示例11: envoi_mail
/**
* Send email
*
* @param string $mode Mode (test | confirm)
* @param string $oldemail Target email
* @param string $message Message to send
* @param string $total Total amount of unpayed invoices
* @param string $userlang Code lang to use for email output.
* @param string $oldtarget Target name
* @param int $duration_value duration value
* @return int <0 if KO, >0 if OK
*/
function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
{
global $conf, $langs;
if (getenv('DOL_FORCE_EMAIL_TO')) {
$oldemail = getenv('DOL_FORCE_EMAIL_TO');
}
$newlangs = new Translate('', $conf);
$newlangs->setDefaultLang(empty($userlang) ? empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT : $userlang);
$newlangs->load("main");
$newlangs->load("contracts");
if ($duration_value) {
if ($duration_value > 0) {
$title = $newlangs->transnoentities("ListOfServicesToExpireWithDuration", $duration_value);
} else {
$title = $newlangs->transnoentities("ListOfServicesToExpireWithDurationNeg", $duration_value);
}
} else {
$title = $newlangs->transnoentities("ListOfServicesToExpire");
}
$subject = empty($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_SUBJECT) ? $title : $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_SUBJECT;
$sendto = $oldemail;
$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
$msgishtml = -1;
print "- Send email to '" . $oldtarget . "' (" . $oldemail . "), total: " . $total . "\n";
dol_syslog("email_expire_services_to_customers.php: send mail to " . $oldemail);
$usehtml = 0;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER)) {
$usehtml += 1;
}
$allmessage = '';
if (!empty($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER;
} else {
$allmessage .= "Dear customer" . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
$allmessage .= "Please, find a summary of the services contracted by you that are about to expire." . ($usehtml ? "<br>\n" : "\n") . ($usehtml ? "<br>\n" : "\n");
}
$allmessage .= $message . ($usehtml ? "<br>\n" : "\n");
//$allmessage.= $langs->trans("Total")." = ".price($total,0,$userlang,0,0,-1,$conf->currency).($usehtml?"<br>\n":"\n");
if (!empty($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER)) {
$allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER;
if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER)) {
$usehtml += 1;
}
}
$mail = new CMailFile($subject, $sendto, $from, $allmessage, array(), array(), array(), '', '', 0, $msgishtml);
$mail->errors_to = $errorsto;
// Send or not email
if ($mode == 'confirm') {
$result = $mail->sendfile();
if (!$result) {
print "Error sending email " . $mail->error . "\n";
dol_syslog("Error sending email " . $mail->error . "\n");
}
} else {
print "No email sent (test mode)\n";
dol_syslog("No email sent (test mode)");
$mail->dump_mail();
$result = 1;
}
unset($newlangs);
if ($result) {
return 1;
} else {
return -1;
}
}
开发者ID:Samara94, 项目名称:dolibarr, 代码行数:82, 代码来源:email_expire_services_to_customers.php
示例12: _sendByMail
function _sendByMail(&$db, &$conf, &$user, &$langs, &$facture, &$societe, $label)
{
$filename_list = array();
$mimetype_list = array();
$mimefilename_list = array();
$ref = dol_sanitizeFileName($facture->ref);
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '([^\\-])+');
$file = $fileparams['fullname'];
// Build document if it not exists
if (!$file || !is_readable($file)) {
$result = $facture->generateDocument($facture->modelpdf, $langs, 0, 0, 0);
if ($result <= 0) {
$error = 1;
return $error;
}
}
$label = !empty($conf->global->SENDINVOICETOADHERENT_SUBJECT) ? $conf->global->SENDINVOICETOADHERENT_SUBJECT : $label;
$substitutionarray = array('__NAME__' => $societe->name, '__REF__' => $facture->ref);
$message = $conf->global->SENDINVOICETOADHERENT_MESSAGE;
$message = make_substitutions($message, $substitutionarray);
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '([^\\-])+');
$file = $fileparams['fullname'];
$filename = basename($file);
$mimefile = dol_mimetype($file);
$filename_list[] = $file;
$mimetype_list[] = $mimefile;
$mimefilename_list[] = $filename;
$CMail = new CMailFile($label, $societe->email, $conf->global->MAIN_MAIL_EMAIL_FROM, $message, $filename_list, $mimetype_list, $mimefilename_list, '', '', '', '', $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO);
// Send mail
return $CMail->sendfile();
}
开发者ID:ATM-Consulting, 项目名称:dolibarr_module_sendinvoicetoadherent, 代码行数:31, 代码来源:sendinvoicetoadherent.php
示例13: sendNotification
/**
*@desc Envoi de la notification
*@param
* $mailSubject : Objet de l'email
* $toNumber : destinatires (email et numéro de fax séparés par des virgules)
* $filename : nom du fichier à envoyer
* $bodyMessage : corps du message email
*@author tpi
*@return
* boolean
*@comment
*/
function sendNotification($htmlContent, $mailSubject, $recipients, $filename, $bodyMessage,$ajax)
{
$ajax->addLog("sendNotification(\$htmlContent, $mailSubject, $recipients, $filename, \$bodyMessage)",INFO);
require_once(dirname(__FILE__) ."/CMailFile.php3");
try
{
$htmlTemp = tempnam("/tmp","htmlDocGfpc");
$tmpHandle = fopen($htmlTemp,"w");
fwrite($tmpHandle,$htmlContent);
fclose($tmpHandle);
# Tell HTMLDOC not to run in CGI mode...
putenv("HTMLDOC_NOCGI=1");
//Generation et affichage sur la sortie standard
//$cmd = "htmldoc -f $filename -t pdf --quiet --color --webpage --jpeg --left 30 --top 20 --bottom 20 --right 20 --footer c.: --fontsize 10 --textfont {helvetica}";
$cmd = "htmldoc -t pdf --quiet --color --webpage --jpeg --left 30 --top 20 --bottom 20 --right 20 --footer c.: --fontsize 10 --textfont {helvetica}";
ob_start();
$err = passthru("$cmd '$htmlTemp'");
$content = ob_get_contents();
ob_end_clean();
$tmpHandle = fopen("/tmp/".$filename,"w");
fwrite($tmpHandle,$content);
fclose($tmpHandle);
unlink($htmlTemp);
if($err!=0){
throw new Exception("HTMLDOC error with code '$err'.");
}
$newmail = new CMailFile($mailSubject,$recipients,"[email protected] ",utf8_decode($bodyMessage),dirname(__FILE__)."/tmp/$filename","application/octet-stream",$filename);
$newmail->sendfile();
$ajax->addLog("Notification sent : $mailSubject",INFO);
return true;
}
catch(Exception $e)
{
$str= "Error while sending a notification (".$filename.") : Line ". $e->getLine() ." - ". $e->getMessage() ." (". __METHOD__ .")";
$ajax->addLog($str,ERROR);
return false;
}
}
开发者ID:ThomasPerraudin, 项目名称:ALIX-EDC-SOLUTIONS, 代码行数:54, 代码来源:hookFunctions.php
示例14: send_password
/**
* Send new password by email
*
* @param User $user Object user that send email
* @param string $password New password
* @param int $changelater 1=Change password only after clicking on confirm email
* @return int < 0 si erreur, > 0 si ok
*/
function send_password($user, $password = '', $changelater = 0)
{
global $conf, $langs;
global $dolibarr_main_url_root;
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$msgishtml = 0;
// Define $msg
$mesg = '';
$outputlangs = new Translate("", $conf);
if (isset($this->conf->MAIN_LANG_DEFAULT) && $this->conf->MAIN_LANG_DEFAULT != 'auto') {
// If user has defined its own language (rare because in most cases, auto is used)
$outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT);
} else {
// If user has not defined its own language, we used current language
$outputlangs = $langs;
}
$outputlangs->load("main");
$outputlangs->load("errors");
$outputlangs->load("users");
$outputlangs->load("other");
$subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword");
// Define $urlwithroot
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$urlwithroot = DOL_MAIN_URL_ROOT;
// This is to use same domain name than current
if (!$changelater) {
$mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . ".\n";
$mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs") . " :\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
$mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
$mesg .= "\n";
$url = $urlwithroot . '/';
$mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $conf->global->MAIN_APPLICATION_TITLE) . ': ' . $url . "\n\n";
$mesg .= "--\n";
$mesg .= $user->getFullName($outputlangs);
// Username that make then sending
} else {
$mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . "\n";
$mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe") . " :\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
$mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
$mesg .= "\n";
$mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange") . " :\n";
$url = $urlwithroot . '/user/passwordforgotten.php?action=validatenewpassword&username=' . $this->login . "&passwordhash=" . dol_hash($password);
$mesg .= $url . "\n\n";
$mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing") . "\n\n";
dol_syslog(get_class($this) . "::send_password url=" . $url);
}
$mailfile = new CMailFile($subject, $this->email, $conf->notification->email_from, $mesg, array(), array(), array(), '', '', 0, $msgishtml);
if ($mailfile->sendfile()) {
return 1;
} else {
$langs->trans("errors");
$this->error = $langs->trans("ErrorFailedToSendPassword") . ' ' . $mailfile->error;
return -1;
}
}
开发者ID:Samara94, 项目名称:dolibarr, 代码行数:66, 代码来源:user.class.php
示例15: send_password
/**
* \brief Envoie mot de passe par mail
* \param user Object user de l'utilisateur qui fait l'envoi
* \param password Nouveau mot de passe
* \param changelater 1=Change password only after clicking on confirm email
* \return int < 0 si erreur, > 0 si ok
*/
function send_password($user, $password = '', $changelater = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . "/lib/CMailFile.class.php";
$subject = $langs->trans("SubjectNewPassword");
$msgishtml = 0;
// Define $msg
$mesg = '';
$outputlangs = new Translate("", $conf);
if (isset($this->conf->MAIN_LANG_DEFAULT) && $this->conf->MAIN_LANG_DEFAULT != 'auto') {
// If user has defined its own language (rare because in most cases, auto is used)
$outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT);
} else {
// If user has not defined its own language, we used current language
$outputlangs = $langs;
}
// Define urlwithouturlroot
if (!empty($_SERVER["HTTP_HOST"])) {
$urlwithouturlroot = 'http://' . preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', $_SERVER["HTTP_HOST"]);
} else {
$urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', $dolibarr_main_url_root);
}
if (!empty($dolibarr_main_force_https)) {
$urlwithouturlroot = preg_replace('/http:/i', 'https:', $urlwithouturlroot);
}
// TODO Use outputlangs to translate messages
if (!$changelater) {
$mesg .= "A request to change your Dolibarr password has been received.\n";
$mesg .= "This is your new keys to login:\n\n";
$mesg .= $langs->trans("Login") . " : {$this->login}\n";
$mesg .= $langs->trans("Password") . " : {$password}\n\n";
$mesg .= "\n";
$url = $urlwithouturlroot . DOL_URL_ROOT;
$mesg .= 'Click here to go to Dolibarr: ' . $url . "\n\n";
$mesg .= "--\n";
$mesg .= $user->getFullName($langs);
// Username that make then sending
} else {
$mesg .= "A request to change your Dolibarr password has been received.\n";
$mesg .= "Your new key to login will be:\n\n";
$mesg .= $langs->trans("Login") . " : {$this->login}\n";
$mesg .= $langs->trans("Password") . " : {$password}\n\n";
$mesg .= "\n";
$mesg .= "You must click on the folowing link to validate its change.\n";
$url = $urlwithouturlroot . DOL_URL_ROOT . '/user/passwordforgotten.php?action=validatenewpassword&username=' . $this->login . "&passwordmd5=" . md5($password);
$mesg .= $url . "\n\n";
$mesg .= "If you didn't ask anything, just forget this email\n\n";
dol_syslog("User::send_password url=" . $url);
}
$mailfile = new CMailFile($subject, $this->email, $conf->notification->email_from, $mesg, array(), array(), array(), '', '', 0, $msgishtml);
if ($mailfile->sendfile()) {
return 1;
} else {
$this->error = $langs->trans("ErrorFailedToSendPassword") . ' ' . $mailfile->error;
//print nl2br($mesg);
return -1;
}
}
开发者ID:netors, 项目名称:dolibarr, 代码行数:65, 代码来源:user.class.php
示例16: dol_dir_list
if (!empty($object->bgcolor)) {
$arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor) ? '' : '#') . $object->bgcolor;
}
if (!empty($object->bgimage)) {
$arr_css['bgimage'] = $object->bgimage;
}
// Attached files
$listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$arr_file[] = $listofpaths[$key]['fullname'];
$arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
$arr_name[] = $listofpaths[$key]['name'];
}
}
$mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css);
$result = $mailfile->sendfile();
if ($result) {
setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs');
} else {
setEventMessages($langs->trans("ResultKo") . '<br>' . $mailfile->error . ' ' . $result, null, 'errors');
}
$action = '';
}
}
// Action add emailing
if ($action == 'add') {
$mesgs = array();
$object->email_from = trim($_POST["from"]);
$object->email_replyto = trim($_POST["replyto"]);
$object->email_errorsto = trim($_POST["errorsto"]);
开发者ID:Albertopf, 项目名称:prueba, 代码行数:31, 代码来源:card.php
The BolunHan/Krypton repository through 2021-06-03 on GitHub allows absolute pat
阅读:686| 2022-07-29
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1223| 2022-08-30
ozzieperez/packtpub-library-downloader: Script to download all your PacktPub ebo
阅读:535| 2022-08-15
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1136| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:947| 2022-11-06
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1344| 2022-08-18
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:491| 2022-08-16
PacktPublishing/Mastering-Embedded-Linux-Programming-Third-Edition: Mastering Em
阅读:747| 2022-08-15
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:644| 2022-11-06
shem8/MaterialLogin: Login view with material design
阅读:726| 2022-08-17
请发表评论