$subject = $data->subject; } // An instance id is needed before storing the file repository file_save_draft_area_files($data->attachments, $context->id, 'block_quickmail', 'attachment_' . $table, $data->id, $editor_options); // Send emails if (isset($data->send)) { if ($type == 'drafts') { quickmail::draft_cleanup($typeid); } if (!empty($sigs) and $data->sigid > -1) { $sig = $sigs[$data->sigid]; $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_quickmail', 'signature', $sig->id, $editor_options); $data->message .= $signaturetext; } // Append links to attachments, if any $data->message .= quickmail::process_attachments($context, $data, $table, $data->id); // Prepare html content of message $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options); // Same user, alternate email if (!empty($data->alternateid)) { $user = clone $USER; $user->email = $alternates[$data->alternateid]; } else { $user = $USER; } foreach (explode(',', $data->mailto) as $userid) { $success = email_to_user($everyone[$userid], $user, $subject, strip_tags($data->message), $data->message); if (!$success) { $warnings[] = get_string("no_email", 'block_quickmail', $everyone[$userid]); } }
$sig = $sigs[$data->sigid]; $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_quickmail', 'signature', $sig->id, $editor_options); } // Prepare html content of message ///////////////////////////////// //$data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options); if (empty($signaturetext)) { $data->messageWithSigAndAttach = $data->message; } else { if ($data->format == 0 || $data->format == 2) { $data->messageWithSigAndAttach = $data->message . "\n\n" . $signaturetext; } else { $data->messageWithSigAndAttach = $data->message . "<br /> <br /> <p></p>" . $signaturetext; } } // Append links to attachments, if any ///////////////////////////// $data->messageWithSigAndAttach .= quickmail::process_attachments($context, $data, $table, $data->id); // Prepare html content of message $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options); // Same user, alternate email ////////////////////////////////////// if (!empty($data->alternateid)) { $user = clone $USER; $user->email = $alternates[$data->alternateid]; } else { $user = $USER; } $data->failuserids = array(); // DWE -> Begin hopefully new way of dealing with messagetext and messagehtml // TEXT // This is where we'll need to factor in the preferences of the receiver. $messagetext = format_text_email($data->messageWithSigAndAttach, $data->format); // HTML
$data = file_postupdate_standard_editor($data, 'message', $editor_options, $context, 'block_quickmail', $table, $data->id); $DB->update_record('block_quickmail_' . $table, $data); $prepender = $config['prepend_class']; if (!empty($prepender) and !empty($course->{$prepender})) { $subject = "[{$course->{$prepender}}] {$data->subject}"; } else { $subject = $data->subject; } // An instance id is needed before storing the file repository file_save_draft_area_files($data->attachments, $context->id, 'block_quickmail', 'attachment_' . $table, $data->id); // Send emails if (isset($data->send)) { if ($type == 'drafts') { quickmail::draft_cleanup($typeid); } list($zipname, $zip, $actual_zip) = quickmail::process_attachments($context, $data, $table, $data->id); if (!empty($sigs) and $data->sigid > -1) { $sig = $sigs[$data->sigid]; $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_quickmail', 'signature', $sig->id, $editor_options); $data->message .= $signaturetext; } // Prepare html content of message $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options); // Same user, alternate email if (!empty($data->alternateid)) { $user = clone $USER; $user->email = $alternates[$data->alternateid]; } else { $user = $USER; } foreach (explode(',', $data->mailto) as $userid) {