You are here

function system_service_mailprepare in Services 6.2

Same name and namespace in other branches
  1. 6 services/system_service/system_service.inc \system_service_mailprepare()
  2. 7 services/system_service/system_service.inc \system_service_mailprepare()

Send an email using the Services module.

Parameters

$mailkey: A key to identify the e-mail sent.

$to: The recipient's email address(es). The formatting of this string must comply with RFC 2822.

$subject: The subject of the email.

$body: The body of the email.

$from: The sender's email address.

$headers: An associative array of optional mail headers.

Return value

An array structure containing all details of the message.

See also

hook_mail()

drupal_mail()

1 string reference to 'system_service_mailprepare'
system_service_service in services/system_service/system_service.module
Implementation of hook_service().

File

services/system_service/system_service.inc, line 60
Link general system functionalities to services module.

Code

function system_service_mailprepare($mailkey, $to, $subject, $body, $from = NULL, $headers = array()) {
  $params = array();
  $params['subject'] = $subject;
  $params['body'] = $body;
  $params['headers'] = $headers;
  $status = drupal_mail('system_service', $mailkey, $to, user_preferred_language($to), $params, $from, TRUE);
  if (!$status) {
    return services_error(t('There was a problem sending your email.'));
  }
  return $status;
}