本文整理汇总了PHP中CMailFile::dump_mail方法的典型用法代码示例。如果您正苦于以下问题:PHP CMailFile::dump_mail方法的具体用法?PHP CMailFile::dump_mail怎么用?PHP CMailFile::dump_mail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMailFile
的用法示例。
在下文中一共展示了CMailFile::dump_mail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: 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;
}
}
示例3: 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;
}
}