You are here

function simplenews_set_from in Simplenews 5

Helper function to set from name and e-mail for a mail object.

Newsletter specific from name and address are set by admin. They default to Simplenews general from name and address. Which on their turn default to site name and from email address.

Parameters

object &$mail simplenews mail object.:

integer $tid newsletter term id:

2 calls to simplenews_set_from()
simplenews_node_prepare in ./simplenews.module
Prepare node for sending
theme_simplenews_newsletter_confirmation in ./simplenews.module
Construct the themable newsletter confirmation email.

File

./simplenews.module, line 1200

Code

function simplenews_set_from(&$mail, $tid = NULL) {
  $address_default = variable_get('site_mail', ini_get('sendmail_from'));
  $name_default = variable_get('site_name', 'drupal');
  if (isset($tid)) {
    $mail->from_address = variable_get('simplenews_from_address_' . $tid, variable_get('simplenews_from_address', $address_default));
    $mail->from_name = variable_get('simplenews_from_name_' . $tid, variable_get('simplenews_from_name', $name_default));
  }
  else {
    $mail->from_address = variable_get('simplenews_from_address', $address_default);
    $mail->from_name = variable_get('simplenews_from_name', $name_default);
  }
}