本文整理汇总了PHP中FormMail类的典型用法代码示例。如果您正苦于以下问题:PHP FormMail类的具体用法?PHP FormMail怎么用?PHP FormMail使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormMail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mailSchedule
function mailSchedule(Expo $expo, Worker $worker)
{
$savList = ShiftAssignmentView::selectWorker($expo->expoid, $worker->workerid);
$paramNames = array("FIRSTNAME", "EXPONAME");
$params = array("FIRSTNAME" => $worker->firstName, "EXPONAME" => $expo->title);
$body = "Hello FIRSTNAME,\n\nYour schedule for EXPONAME is:\n";
$body .= sprintfSchedule($savList);
$body .= "\n\nSincerely,\nThe " . SITE_NAME . " Team";
$form = new FormMail($expo->title . " Schedule", $paramNames, $body);
$form->sendForm($worker->email, $params);
}
示例2: sendForm
/**
* This is the base function for sending mail;
* it looks up the form, and fills in the params,
* then calls mail.
*/
public function sendForm($to, array $params = NULL)
{
try {
$sendBody = $this->body;
if (!is_null($params)) {
if (count($this->paramNames) != count($params)) {
logMessage('FormMail.sendForm(' . $to . ')', 'params do not match');
}
$sendBody = $this->body;
foreach ($this->paramNames as $param) {
$sendBody = str_replace($param, $params[$param], $sendBody);
}
}
FormMail::send($to, $this->subject, $sendBody);
} catch (Exception $ex) {
logMessage('FormMail.sendForm(' . $to . ')', $ex->getMessage());
}
}
示例3: dol_escape_htmltag
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")) . '">' . $langs->trans("DeleteMailing") . '</a>';
} else {
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=delete&id=' . $object->id . (!empty($urlfrom) ? '&urlfrom=' . $urlfrom : '') . '">' . $langs->trans("DeleteMailing") . '</a>';
}
}
print '<br><br></div>';
}
if (!empty($mesgembedded)) {
dol_htmloutput_mesg($mesgembedded, '', 'warning', 1);
}
// Affichage formulaire de TEST
if ($action == 'test') {
print_titre($langs->trans("TestMailing"));
// Create l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
$formmail->frommail = $object->email_from;
$formmail->withsubstit = 1;
$formmail->withfrom = 0;
$formmail->withto = $user->email ? $user->email : 1;
$formmail->withtocc = 0;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic = 0;
$formmail->withtopicreadonly = 1;
$formmail->withfile = 0;
$formmail->withbody = 0;
$formmail->withbodyreadonly = 1;
$formmail->withcancel = 1;
$formmail->withdeliveryreceipt = 0;
// Tableau des substitutions
示例4: dol_sanitizeFileName
/*
* Action presend
*/
if ($action == 'presend')
{
$ref = dol_sanitizeFileName($object->ref);
$file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>';
print_titre($langs->trans('SendInterventionByMail'));
// Create form object
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db);
$formmail->fromtype = 'user';
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
$formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"];
$formmail->withtosocid=$societe->id;
$formmail->withtocc=1;
$formmail->withtoccsocid=0;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__');
$formmail->withfile=2;
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
示例5: swwat_parse_string
$message = swwat_parse_string(html_entity_decode($_POST[PARAM_MESSAGE]));
$list = $_POST[PARAM_LIST_INDEX];
if (!is_null($list) && ($typeFlag && (!is_null($subject) || !is_null($message)) || !$typeFlag && !is_null($message))) {
if (!$typeFlag) {
$subject = "";
// ensure blank
$message = substr($message, 0, 160);
}
$workerList = $_SESSION[PARAM_LIST];
for ($k = 0; $k < count($list); $k++) {
try {
$listIndex = swwat_parse_number(html_entity_decode($list[$k]), FALSE);
$worker = $workerList[$listIndex];
$to = $typeFlag ? $worker->email : $worker->smsemail;
if (!is_null($to) && strlen($to) > 0) {
FormMail::send($to, $subject, $message);
} else {
/* continue to process list */
logMessage("SendMessageAction", "failure with to field:" . $to . " index:" . $k . " value:" . $list[$k]);
}
} catch (ParseSWWATException $pe) {
/* continue to process list */
logMessage("SendMessageAction", "failure with index:" . $k . " value:" . $list[$k]);
}
}
// $k
}
// all null
// return to whence we came
if (is_null(getStationCurrent())) {
if (is_null(getExpoCurrent())) {
示例6: setEventMessage
} else {
$errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
if ($mail->error) {
$errormsg .= ' - ' . $mail->error;
}
setEventMessage($errormsg, 'errors');
}
print '<br>';
}
// Show email send test form
if ($action == 'test' || $action == 'testhtml') {
print '<br>';
print_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM;
$formmail->frommail = isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM;
$formmail->withfromreadonly = 0;
$formmail->withsubstit = 0;
$formmail->withfrom = 1;
$formmail->witherrorsto = 1;
$formmail->withto = !empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1);
$formmail->withtocc = !empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1;
// ! empty to keep field if empty
$formmail->withtoccc = !empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1;
// ! empty to keep field if empty
$formmail->withtopic = isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test");
$formmail->withtopicreadonly = 0;
$formmail->withfile = 2;
$formmail->withbody = isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"));
示例7: accessforbidden
accessforbidden();
}
$upload_dir = $conf->admin->dir_temp;
/*
* Actions
*/
if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$result = dol_mkdir($upload_dir);
// Create dir if not exists
if ($result >= 0) {
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 1, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) {
$mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'], $_FILES['addedfile']['name'], $_FILES['addedfile']['type']);
} else {
$langs->load("errors");
if ($resupload < 0) {
$mesg = '<div class="error">' . $langs->trans("ErrorFileNotUploaded") . '</div>';
} else {
if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/', $resupload, $reg)) {
$mesg = '<div class="error">' . $langs->trans("ErrorFileIsInfectedWithAVirus");
$mesg .= '<br>' . $langs->trans("Information") . ': ' . $langs->trans($reg[1]);
$mesg .= '</div>';
} else {
$mesg = '<div class="error">' . $langs->trans($resupload) . '</div>';
}
}
}
示例8: doActions
/** Overloading the doActions function : replacing the parent's function with the one below
* @param parameters meta datas of the hook (context, etc...)
* @param object the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param action current action (if set). Generally create or edit or null
* @return void
*/
function doActions($parameters, &$object, &$action, $hookmanager)
{
global $langs, $user, $db;
if ($action == "send") {
switch ($parameters['context']) {
case 'propalcard':
if (!GETPOST('addfile') && !GETPOST('removedfile') && !GETPOST('cancel')) {
$langs->load('mails');
$result = $object->fetch(GETPOST("id"));
$result = $object->fetch_thirdparty();
if ($result > 0) {
if (GETPOST('sendto')) {
// Le destinataire a ete fourni via le champ libre
$sendto = GETPOST('sendto');
$sendtoid = 0;
} elseif (GETPOST('receiver') != '-1') {
// Recipient was provided from combo list
if (GETPOST('receiver') == 'thirdparty') {
// Id of third party
$sendto = $object->client->email;
$sendtoid = 0;
} else {
// Id du contact
$sendto = $object->client->contact_get_property(GETPOST('receiver'), 'email');
$sendtoid = GETPOST('receiver');
}
}
if (dol_strlen($sendto)) {
$langs->load("commercial");
$from = GETPOST('fromname') . ' <' . GETPOST('frommail') . '>';
$replyto = GETPOST('replytoname') . ' <' . GETPOST('replytomail') . '>';
$message = GETPOST('message');
$sendtocc = GETPOST('sendtocc');
$deliveryreceipt = GETPOST('deliveryreceipt');
if (GETPOST('action') == 'send') {
if (dol_strlen(GETPOST('subject'))) {
$subject = GETPOST('subject');
} else {
$subject = $langs->transnoentities('Propal') . ' ' . $object->ref;
}
$actiontypecode = 'AC_PROP';
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
if ($message) {
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$actionmsg .= $message;
}
$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 . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt);
if (!$mailfile->error) {
$mailfile->message = stripslashes($mailfile->message);
$msg_prepared = $mailfile->headers . $mailfile->eol;
$msg_prepared .= $mailfile->subject . $mailfile->eol;
$msg_prepared .= $mailfile->message . $mailfile->eol;
$object->msg_imap_result = store_email_into_folder($msg_prepared);
}
}
}
}
break;
case 'ordercard':
if (!GETPOST('addfile') && !GETPOST('removedfile') && !GETPOST('cancel')) {
$langs->load('mails');
$result = $object->fetch(GETPOST("id"));
$result = $object->fetch_thirdparty();
if ($result > 0) {
if (GETPOST('sendto')) {
// Le destinataire a ete fourni via le champ libre
$sendto = GETPOST('sendto');
$sendtoid = 0;
} elseif (GETPOST('receiver') != '-1') {
// Recipient was provided from combo list
if (GETPOST('receiver') == 'thirdparty') {
// Id of third party
$sendto = $object->client->email;
$sendtoid = 0;
} else {
// Id du contact
$sendto = $object->client->contact_get_property(GETPOST('receiver'), 'email');
$sendtoid = GETPOST('receiver');
}
}
if (dol_strlen($sendto)) {
$langs->load("commercial");
//.........这里部分代码省略.........
示例9: GETPOST
if (!$file || !is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print load_fiche_titre($langs->trans($titreform));
// Cree l'objet formulaire mail
dol_fiche_head();
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang;
$formmail->fromtype = 'user';
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && $conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1) {
$formmail->trackid = 'inv' . $object->id;
}
if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && $conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2) {
include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$formmail->frommail = dolAddEmailTrackId($formmail->frommail, 'inv' . $object->id);
}
$formmail->withfrom = 1;
$liste = array();
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
示例10: FormMail
if (($mil->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$mil->id.'">'.$langs->trans("DeleteMailing").'</a>';
}
print '<br><br></div>';
}
// Affichage formulaire de TEST
if ($_GET["action"] == 'test')
{
print_titre($langs->trans("TestMailing"));
// Create l'objet formulaire mail
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db);
$formmail->fromname = $mil->email_from;
$formmail->frommail = $mil->email_from;
$formmail->withsubstit=1;
$formmail->withfrom=0;
$formmail->withto=$user->email?$user->email:1;
$formmail->withtocc=0;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=0;
$formmail->withtopicreadonly=1;
$formmail->withfile=0;
$formmail->withbody=0;
$formmail->withbodyreadonly=1;
$formmail->withcancel=1;
$formmail->withdeliveryreceipt=0;
// Tableau des substitutions
示例11: foreach
// create data array
// loop over array of emails
foreach ($email_array as $email) {
$messages = $messagedata[$email];
$subject = $messages[0]->expo . " Reminder";
$message = "Dear " . $messages[0]->workerName . ",\n\n";
if (PARAM_ANTEREMINDER_TIME == 1) {
$message .= "This message is to remind you that your upcoming shift assignment for " . PARAM_ANTEREMINDER_TIME . " day from now is:\n\n";
} else {
$message .= "This message is to remind you that your upcoming shift assignment for " . PARAM_ANTEREMINDER_TIME . " days from now is:\n\n";
}
$message .= "Expo: " . $messages[0]->expo . "\n\n";
$body = $message;
foreach ($messages as $message) {
$body .= "Station: " . $message->station . "\n";
$shift = explode(';', swwat_format_shift($message->startTime, $message->stopTime));
$body .= "Time: " . $shift[0] . " (" . $shift[1] . ")\n";
}
// $message
//START SIGNATURE BLOCK
$message .= "\n\n Your participation in the conference is appreciated.";
// $message .= "\n\n Please notify us at zzz-xxx-yyyy if unable to make your shift.";
$message .= "\n\n Thank you,";
$message .= "\n\n Your " . SITE_NAME . " Team";
// ENDIT SIGNATURE BLOCK
FormMail::send($email, $subject, $body);
logMessage("SendMessagesCron", "email sent to " . $email);
}
// $email
ReminderSent::insert(swwat_format_isodate($targtag));
logMessage("SendMessagesCron", "Date: " . swwat_format_isodate($targtag) . " written to database.");
示例12: dol_remove_file_process
/**
* Remove an uploaded file (for example after submitting a new file a mail form).
* All information used are in db, conf, langs, user and _FILES.
* @param filenb File nb to delete
* @param donotupdatesession 1=Do not edit _SESSION variable
* @param donotdeletefile 1=Do not delete physically file
* @return string Message with result of upload and store.
*/
function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0)
{
global $db,$user,$conf,$langs,$_FILES;
$mesg='';
$keytodelete=$filenb;
$keytodelete--;
$listofpaths=array();
$listofnames=array();
$listofmimes=array();
if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]);
if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]);
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
if ($keytodelete >= 0)
{
$pathtodelete=$listofpaths[$keytodelete];
$filetodelete=$listofnames[$keytodelete];
if (empty($donotdeletefile)) $result = dol_delete_file($pathtodelete,1);
else $result=0;
if ($result >= 0)
{
if (empty($donotdeletefile))
{
$langs->load("other");
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",$filetodelete).'</div>';
//print_r($_FILES);
}
if (empty($donotupdatesession))
{
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db);
$formmail->remove_attached_files($keytodelete);
}
}
}
return $mesg;
}
示例13: swwat_parse_string
<?php
// $Id: WorkerLoginResetAction.php 1345 2012-08-21 15:40:38Z preston $ Copyright (c) ConSked, LLC. All Rights Reserved.
include 'util/authenticate.php';
require_once 'properties/constants.php';
require_once 'db/WorkerLogin.php';
require_once 'util/log.php';
require_once 'util/mail.php';
require_once 'util/session.php';
require_once 'swwat/gizmos/parse.php';
/**
* This Controller is used by the WorkerLoginPage's reset button (typically used by the Worker themselves)
* vs. the WorkerViewPage's reset button (typically used by an Organizer)
*/
$email = swwat_parse_string(html_entity_decode($_POST[PARAM_EMAIL]), true);
if (is_null($email)) {
throw new LoginException('username required');
}
try {
$password = WorkerLogin::password_reset($email);
FormMail::sendPasswordReset($email, $password);
$password = NULL;
} catch (Exception $ex) {
logMessage('WorkerLoginResetAction error', $ex->getMessage());
}
$password = NULL;
// in all cases; redirect back to Login page
header('Location: WorkerLoginPage.php');
include 'WorkerLoginPage.php';
示例14: dol_htmloutput_mesg
} else {
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=delete&id=' . $object->id . (!empty($urlfrom) ? '&urlfrom=' . $urlfrom : '') . '">' . $langs->trans("DeleteMailing") . '</a>';
}
}
print '<br><br></div>';
}
if (!empty($mesgembedded)) {
dol_htmloutput_mesg($mesgembedded, '', 'warning', 1);
print '<br>';
}
// Affichage formulaire de TEST
if ($action == 'test') {
print_titre($langs->trans("TestMailing"));
// Create l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = $object->email_from;
$formmail->frommail = $object->email_from;
$formmail->withsubstit = 1;
$formmail->withfrom = 0;
$formmail->withto = $user->email ? $user->email : 1;
$formmail->withtocc = 0;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic = 0;
$formmail->withtopicreadonly = 1;
$formmail->withfile = 0;
$formmail->withbody = 0;
$formmail->withbodyreadonly = 1;
$formmail->withcancel = 1;
$formmail->withdeliveryreceipt = 0;
// Tableau des substitutions
示例15: FormMail
}
$formmail->show_form('addfile','removefile');
print '<br>';
}
// Affichage formulaire de TEST HTML
if ($_GET["action"] == 'testhtml')
{
print '<br>';
print_titre($langs->trans("DoTestSendHTML"));
// Cree l'objet formulaire mail
include_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php");
$formmail = new FormMail($db);
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->withfromreadonly=0;
$formmail->withsubstit=0;
$formmail->withfrom=1;
$formmail->witherrorsto=1;
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
$formmail->withtopicreadonly=0;
$formmail->withfile=2;
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("PredefinedMailTestHtml"));
//$formmail->withbody='Test <b>aaa</b> __LOGIN__';
$formmail->withbodyreadonly=0;