You are here

public function NewsletterBasic::sendBasic in Newsletter 7

Same name and namespace in other branches
  1. 7.2 includes/newsletter.basic.inc \NewsletterBasic::sendBasic()

Sends email to a subscriber using a basic template (confirmation/welcome/unsubscribe emails).

Parameters

$id: The the basic template id of this email.

$to: The e-mail to send the newsletter confirmation to.

File

includes/newsletter.basic.inc, line 44
Contains NewsletterBasic class and newsletter's module implementation of drupal mail system.

Class

NewsletterBasic
Basic Newsletter class.

Code

public function sendBasic($id, $to) {
  $template = newsletter_template_load($id);
  $subscriber = newsletter_subscriber_load(array(), array(
    'email' => $to,
  ));
  $params = array(
    'template' => $template,
    'subscriber' => array_pop($subscriber),
    'format' => $this->format,
  );
  $language = isset($subscriber->language) ? newsletter_language_list($subscriber->language) : $this->language;
  $message = drupal_mail('newsletter', 'basic', $to, $language, $params, $this->from);
  return $message['result'];
}