function mimemail in Mime Mail 6
Same name and namespace in other branches
- 5 mimemail.module \mimemail()
Compose and optionally send a MIME-encoded e-mail message.
Determines the mail engine to use, then prepares the message by calling it's prepare function. Uses the default engine, If another one does not exist.
Parameters
$sender: The email address or user object who is sending the message.
$recipient: An email address or user object who is receiving the message.
$subject: A subject line string.
$body: The message body in HTML format.
$plaintext: Whether to send the message as plaintext only or HTML. If set to 1, Yes or TRUE, then the message will be sent as plaintext.
$headers: Optional e-mail headers in a keyed array.
$text: Optional plaintext portion of a multipart e-mail.
$attachments: An array of arrays which describe one or more attachments. Existing files can be added by path, dinamically-generated files can be added by content. The internal array consists of the following parts:
- filepath: Relative Drupal path to an existing file (filecontent is NULL).
- filecontent: The actual content of the file (filepath is NULL).
- filename: The filename of the file.
- filemime: The MIME type of the file.
The array of arrays looks something like this: Array ( [0] => Array ( [filepath] => '/sites/default/files/attachment.txt' [filecontent] => 'My attachment.' [filename] => 'attachment.txt' [filemime] => 'text/plain' ) )
$mailkey: An identifier for the message.
$send: Send the message directly.
Return value
An array containing the MIME-encoded message, including headers and body.
4 calls to mimemail()
- mimemail.module in ./
mimemail.module - Component module for sending MIME-encoded e-mails.
- mimemail_rules_action_mail_to_user in includes/
mimemail.rules.inc - Implements action to send a mail to a user and to an arbitrary mail address.
- mimemail_rules_action_mail_to_users_of_role in includes/
mimemail.rules.inc - Implements action to send mail to all users of a specific role group(s).
- mimemail_send_mail_action in modules/
mimemail_action/ mimemail_action.module - Implements a configurable Drupal action. Sends an email.
11 string references to 'mimemail'
- mimemail_admin_settings in includes/
mimemail.admin.inc - Module configuration form.
- mimemail_disable in ./
mimemail.install - Implements hook_disable().
- mimemail_mailengine in ./
mimemail.module - The default mailengine.
- mimemail_menu in ./
mimemail.module - Implements hook_menu().
- mimemail_prepare_message in ./
mimemail.module - Default engine's prepare function.
File
- ./
mimemail.module, line 286 - Component module for sending MIME-encoded e-mails.
Code
function mimemail($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '', $send = TRUE) {
$engine = variable_get('mimemail_engine', 'mimemail');
$mailengine = $engine . '_mailengine';
$engine_prepare_message = $engine . '_prepare_message';
if (!$engine || !function_exists($mailengine)) {
return FALSE;
}
if (function_exists($engine_prepare_message)) {
$message = $engine_prepare_message($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
}
else {
$message = mimemail_prepare_message($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
}
// Optionally send e-mail.
if ($send) {
$message['result'] = mimemail_send_message($message);
}
return $message;
}