--- og.module_original 2007-10-04 17:46:26.000000000 -0700 +++ og.module 2007-10-05 12:45:07.000000000 -0700 @@ -1735,7 +1735,17 @@ function og_mail($type, $obj) { $type_friendly = node_get_types('name', $obj); } - $sitemail = variable_get("site_mail", ini_get("sendmail_from")); + $from_type = variable_get("og_new_email_from", "admin"); + if($from_type == 'admin') { + $from_mail = '"' . mime_header_encode($obj->name) . '" <' . variable_get("site_mail", ini_get("sendmail_from")) . '>'; + } else if($from_type == 'site' || !isset($account)) { //handles anonymous account, which won't have own email + $from_mail = '"' . mime_header_encode(variable_get("site_name", 'Drupal')) . '" <' . variable_get("site_mail", ini_get("sendmail_from")) . '>'; + } else if($from_type == 'sitemail') { + $from_mail = variable_get("site_mail", ini_get("sendmail_from")); + } else if($from_type == 'user') { + $from_mail = '"' . mime_header_encode($obj->name) . '" <' . $account->mail . '>'; + } + $headers = array('X-Mailer' => 'Drupal - og_mail', 'Precedence' => 'list', 'Message-Id' => "<$obj->msgid>"); if ($obj->in_reply_to) { $headers['In-Reply-To'] = "<$obj->in_reply_to>"; @@ -1791,7 +1801,7 @@ function og_mail($type, $obj) { 'List-Owner' => mime_header_encode($row->group_owner). " <$ownerurl>", "List-Archive" => "<$group_home>" ); - drupal_mail('og_mail', $row->mail, _og_user_mail_text('og_new_node_subject', $variables), _og_user_mail_text('og_new_node_body', $variables), mime_header_encode($obj->name). " <$sitemail>", $groupheaders); + drupal_mail('og_mail', $row->mail, _og_user_mail_text('og_new_node_subject', $variables), _og_user_mail_text('og_new_node_body', $variables), $from_mail, $groupheaders); } } } @@ -2459,6 +2469,22 @@ function og_admin_settings() { $form['og_settings']['email'] = array('#type' => 'fieldset', '#title' => t('Email settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); $form['og_settings']['email']['og_omitted_email_node_types'] = array('#type' => 'select', '#title' => t('Omitted node types for email notifications'), '#default_value' => variable_get('og_omitted_email_node_types', array()), '#options' => $non_group_type_options, '#description' => t("Select any node types which should not generate email notifications when they are posted into a group."), '#multiple' => TRUE); + + $sn = variable_get("site_name", "Drupal"); + $se = variable_get("site_mail", ini_get("sendmail_from")); + $form['og_settings']['email']['og_new_email_from'] = array( + '#title' => t('Format of "From:" field'), + '#type' => 'radios', + '#options' => array( + 'admin' => t('Username + Admin Email: username @email', array('@email' => "<$se>")), + 'site' => t('Sitename + Admin Email: @sitename @email', array('@sitename' => $sn, '@email' => "<$se>")), + 'sitemail' => t('Admin Email Only: @email', array('@email' => $se)), + 'user' => t('Username + User Email: username @email', array('@email' => '')) + ), + '#default_value' => variable_get('og_new_email_from', 'admin'), + '#description' => t('Pick the format of the "From:" field on outgoing notifications. Note that selecting the username option will reveal the user\'s email address. If the admin email examples above appear blank, you need to set your site email in the Site Configuration panel.'), + ); + $form['og_settings']['email']['og_new_node_subject'] = array('#type' => 'textfield', '#title' => t('New content subject'), '#description' => 'Subject of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @body, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_subject')); $form['og_settings']['email']['og_new_node_body'] = array('#type' => 'textarea', '#title' => t('New content body'), '#rows' => 10, '#description' => 'Body of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @body, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_body')); $form['og_settings']['email']['og_admin_email_body'] = array('#type' => 'textarea', '#title' => t('Group admin email body'), '#rows' => 10, '#description' => 'The body of the email sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe', '#default_value' => _og_user_mail_text('og_admin_email_body'));