本文整理汇总了PHP中FormMail::get_attached_files方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMail::get_attached_files方法的具体用法?PHP FormMail::get_attached_files怎么用?PHP FormMail::get_attached_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormMail
的用法示例。
在下文中一共展示了FormMail::get_attached_files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FormMail
if ($action == 'send' || $action == 'relance') {
if (dol_strlen($_POST['subject'])) {
$subject = $_POST['subject'];
}
$actionmsg2 = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
if ($message) {
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$actionmsg .= $message;
}
}
// 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'];
// Send mail
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
if ($mailfile->error) {
$mesgs[] = '<div class="error">' . $mailfile->error . '</div>';
} else {
$result = $mailfile->sendfile();
if ($result) {
$error = 0;
// Initialisation donnees
$object->socid = $sendtosocid;
// To link to a company
示例2: 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");
//.........这里部分代码省略.........