Provides mail methods to services applications. Requires services.module.

'); case 'admin/modules#description': return t('Provides mail methods to services applications. Requires services.module.'); } } /** * Implementation of hook_service(). */ function mail_service_service() { return array( // mail.send array( '#method' => 'mail.send', '#callback' => 'mail_service_send', '#args' => array( array( '#name' => 'to', '#type' => 'string', '#description' => t('The mail address or addresses where the message will be send to. The formatting of this string must comply with RFC 2822. Some examples are: user@example.com user@example.com, anotheruser@example.com User User , Another User .'), ), array( '#name' => 'subject', '#type' => 'string', '#description' => t('Subject of the e-mail to be sent. This must not contain any newline characters, or the mail may not be sent properly.'), ), array( '#name' => 'body', '#type' => 'string', '#description' => t('Message to be sent. Drupal will format the correct line endings for you.'), ), array( '#name' => 'from', '#type' => 'string', '#description' => t('Sets From, Reply-To, Return-Path and Error-To to this value, if given.'), '#optional' => TRUE, ), array( '#name' => 'headers', '#type' => 'array', '#description' => t('Associative array containing the headers to add. This is typically used to add extra headers (From, Cc, and Bcc). When sending mail, the mail must contain a From header.'), '#optional' => TRUE, ), array( '#name' => 'mailkey', '#type' => 'string', '#description' => t('A key to identify the mail sent, for altering.'), '#optional' => TRUE, ), ), '#return' => 'boolean', '#help' => t('Send an e-mail message, using Drupal variables and default settings. More information in the PHP function reference for mail.') ), ); } /** * Send an e-mail message */ function mail_service_send($to, $subject, $body, $from = NULL, $headers = array(), $mailkey = NULL) { if (empty($mailkey)) { $mailkey = 'mail_service_send'; } return drupal_mail($mailkey, $to, $subject, $body, $from, $headers); }