You are here

function simple_mail_send in Simple Mail 7

Same name and namespace in other branches
  1. 8 simple_mail.module \simple_mail_send()
  2. 2.0.x simple_mail.module \simple_mail_send()

Easy-to-use email sending function.

Parameters

(string) $from: Email sender. Defaults to the system email.

(string) $to: Email receipient.

(string) $subject: Email subject.

(string) $body: Email message body (can be HTML or plaintext).

Return value

(array) Message array structure, as returned by drupal_mail(). Check for 'result' = TRUE to verify that the message was sent (at least, according to PHP).

1 call to simple_mail_send()
simple_mail_send_queued_email in ./simple_mail.module
Callback for sending queued emails via cron.

File

./simple_mail.module, line 95
Simple Mail module.

Code

function simple_mail_send($from, $to, $subject, $body) {
  if (empty($from)) {
    $from = variable_get('site_mail', '');
  }
  $params['subject'] = $subject;
  $params['body'] = $body;
  $lang = language_default();

  // Send email with drupal_mail.
  return drupal_mail('simple_mail', 'simple_mail', $to, $lang, $params, $from);
}