Email notifications from Savannah Frontend

Overriding notification emails during development

Set the following variable in .savane.conf.php:

$sys_debug_email_override_address = "savannah-hackers-tests@gnu.org";

To override any outgoing email notifications, and ensure they are sent only to the development mailing list.

Each email will have the following prepended to the message body:

Savannah Debug: email override is turned on
Original recipient list:
jsmith@example.com
------------

If the variable $sys_debug_email_override_address is set, all emails will be sent to its value (assumed to be a valid email address) regardless of the original recipients for the notification email. It is recommended to set it to savannah-hackers-tests@gnu.org to avoid spamming the public mailing lists. When using this email address, it is recommended to subscribe to this mailing list here: https://lists.gnu.org/mailman/listinfo/savannah-hackers-tests to ensure you (the developer) will receive the notification emails.

If the variable $sys_debug_email_override_address is not set, emails sent from the development site (e.g. new support tickets) are sent to the relevant mailing lists (e.g. savannah-help-public@gnu.org) and will be delivered to all the subscribers - don't spam unnecessarily.

In both cases (variable set or unset), emails sent from the development site originate from www-data@jsmith.frontend0.savnnah.org. The first time emails are sent they will be held in moderation until reviewed by a human (all of Savannah mailing lists are moderated as an anti-spam measure).

It is recommended to send a test email early (e.g. when the development site is first activated), and allow 24 hours for a human moderator to approval this email address. This will save frustrations later on if trying to troubleshoot email issues or adjust email message text.

Email addresses in the database

The PHP website sends notification emails for two types of events:

  1. Group registrations
  2. Group tracker submissions (new bugs/support/tasks/patches/cookbook/news items).

For new group registrations:

mysql> select type_id, name, admin_email_adress from group_type ;
+---------+------------------------------------+----------------------------------+
| type_id | name                               | admin_email_adress               |
+---------+------------------------------------+----------------------------------+
|       1 | Official GNU software              | savannah-register-public@gnu.org |
|       2 | non-GNU software and documentation | savannah-register-public@gnu.org |
|       3 | www.gnu.org portions               | savannah-register-public@gnu.org |
|       4 | GUG                                | savannah-hackers@gnu.org         |
|       6 | www.gnu.org translation teams      | savannah-hackers@gnu.org         |
+---------+------------------------------------+----------------------------------+
5 rows in set (0.00 sec)

For tracker submission in each group:

mysql> select group_id, unix_group_name,
              new_bugs_address, new_patch_address,
              new_support_address, new_task_address,
              new_news_address, new_cookbook_address
       from groups where group_id in ( 5802, 2613, 11318 ) \G

*************************** 1. row ***************************
               group_id: 2613
        unix_group_name: coreutils
       new_bugs_address: jim@xxxxxxxx.yyy, coreutils@gnu.org
      new_patch_address: jim@xxxxxxxx.yyy, bug-coreutils@gnu.org
    new_support_address:
       new_task_address:
       new_news_address: jim@xxxxxxxx.yyy
   new_cookbook_address:
*************************** 2. row ***************************
               group_id: 5802
        unix_group_name: administration
       new_bugs_address:
      new_patch_address:
    new_support_address: savannah-help-public@gnu.org
       new_task_address: savannah-hackers-public@gnu.org
       new_news_address: savannah-users@gnu.org
   new_cookbook_address:
*************************** 3. row ***************************
               group_id: 11318
        unix_group_name: datamash
       new_bugs_address: agn
      new_patch_address: agn
    new_support_address: agn
       new_task_address: agn
       new_news_address: agn
   new_cookbook_address:

PHP code

Email sending code

The function sendmail_mail in <savane>/frontend/php/include/sendmail.php behaves similarly to PHP mail and is used to send email from all savane PHP files.

It performs the following additional tasks:

  1. User and 'squad' expansion (e.g. if the recipient is agn, find the email associated with Savannah user agn).
  2. Processes exclude lists (defined in the configuration section for each group tracker).
  3. Adds additional SMTP headers (e.g. X-Apparently-From: with the logged-in user name, X-Savane-Server, X-Savane-Project, etc.).
  4. If the user has configured a specific SUBJECT line, construct a customized message with it and send it to this user. (on the website, visit "My Account Conf"->"Edit Personal Notification Settings", then see "Subject line" to set a custom one)
  5. If the global variable $sys_debug_email_override_address is set, emails will be sent to the address specified in it, regardless of the original recipients. This can be used during development to ensure emails do not spam public mailing lists or unsuspecting users.

FIXME: There's a variable called $int_delayspamcheck which affects sending - is it ever used? It set to true, messages are added to a DB table trackers_spamcheck_queue_notification instead of being sent.

New group registration

FIXME: What's going on??

The file <savane>/frontend/php/include/group.php contains:

function getTypeAdminEmailAddress()
       { return $this->type_data_array['admin_email_adress']; }

which returns the relevant 'new group' email address for each group type (the group type is selected by the submitter in the html form).

the file <savane>/frontend/php/register2/index.php uses this function to send an email notification about new group registration (note: the /register/ URL is aliased to the /regster2/ directory in the apache configuration)

$type_admin_email_address = $project->getTypeAdminEmailAddress();

But later on this variable is only used as the 'FROM:' field to send a message directly to the user who submitted the new group.

The comment in the code says:

# a mail for the moderators staff!
# Done automatically by the task tracker

And new groups are treated as new tasks (i.e. stored in the tasks tracker) - but Savannah administration group has an empty value for the news_tasks_address - so how do emails end up in savannah-register-public@gnu.org?

New tracker items

FIXME: these functions are not used anywhere ...

The file <savane>/frontend/php/include/group.php contains:

function getNewBugAddress() {
  return $this->data_array['new_bug_address'];
}

function getNewSupportAddress() {
  return $this->data_array['new_support_address'];
}

function getNewTaskAddress() {
  return $this->data_array['new_task_address'];
}

function getNewPatchAddress() {
  return $this->data_array['new_patch_address'];
}

FIXME: try git grep _address | grep new_ to find a lead...