Group Spam System
part of the ArsDigita Community System
by Sarah Ahmed
The Big Picture
This system is designed to handle group level spamming. The site-wide administrator or the group-level administrator can set the group spam policy to be "open", "closed", or "wait". For open spam policy, any member of the group can spam other members/administrators of the group. For "wait" spam policy, spam generated by group members needs to be approved by the group administrator first. For "closed" spam policy, only the group administrators are allowed to spam the group. For any spam policy, spams sent from group admin pages are immediately approved.
Under the Hood
- The system allows each group member to set his/her own email preferences; i.e. a group member will receive group spams only if he sets his personal profile to receive spams. Personal email profile can be set at the user pages. Also, a group spam removal blurb is added at the bottom of each group spam.
- The system also employs a user-level bozo filter. At the bottom of every group spam ( or any spam for that matter), a bozo filter blurb is (can be)appended, which is used to set or unset a filter against the specific sender. This filter can be used to prevent a user from any site-wide email from the sender.
- The system supports personalization of emails - in the message body, one can use variables like <first_names> , <last_name>, <email>,<group_name>,<admin_email>, which are respectively replaced by the receiver's first name, last name, email, the group's name and the group's administrative email.
- We keep a history of all the spam we've sent to users in the
group_spam_history
table, which also serves as a queue to send approved but unsent mails.
- Forms that allow a publisher to spam generate a new spam_id for the blank form; this way a double click does not result in a spam being sent twice.
- When the administrator resets the group spam policy to be "open", all currently "waiting" spams are immediately approved and sent out.
- The system distinguishes between three different states of a spam - "approved", "disapproved", "waiting" ( approved_p is "t", "f", null respectively). In the group admin main page, it only lists spams that are "waiting" for administrator's approval. However, the spam-history page logs all group spams from which the administrator can also approve a previously dispproved email.
Data Model
This system consists of three tables.
The group_spam_history table holds the spamming log for this group. This log is used both for displaying the group/personal email history and as a queue to send approved but unsent emails.
create table group_spam_history (
spam_id integer primary key,
group_id references user_groups not null,
sender_id references users(user_id) not null,
sender_ip_address varchar(50) not null,
from_address varchar(100),
subject varchar(200),
body clob,
send_to varchar (50) default 'members' check (send_to in ('members','administrators')),
creation_date date not null,
-- approved_p matters only for spam policy='wait'
-- approved_p = 't' indicates administrator approved the mail
-- approved_p = 'f' indicates administrator disapproved the mail, so it won't be listed for approval again
-- approved_p = null indicates the mail is not approved/disapproved by the administrator yet
approved_p char(1) default null check (approved_p is null or approved_p in ('t','f')),
send_date date,
-- this holds the number of intended recipients
n_receivers_intended integer default 0,
-- we'll increment this after every successful email
n_receivers_actual integer default 0
);
The group_member_email_preferences table retains email preferences of members that belong to a particular group.
create table group_member_email_preferences (
group_id references user_groups not null,
user_id references users not null ,
dont_spam_me_p char (1) default 'f' check(dont_spam_me_p in ('t','f')),
primary key (group_id, user_id)
);
The user_user_bozo_filter table contains information to implement a personalized "bozo filter". Any user ( origin_user_id) can restrain any emails from some other user ( target_user_id ). This table is not specific to a group.
create table user_user_bozo_filter (
origin_user_id references users not null,
target_user_id references users not null,
primary key (origin_user_id, target_user_id)
);
Legal Transactions
From the group administration pages, the administrator can
- Set the group spam policy
- Send spam to group members
- Send spam to group administrators
- View spam history of the group
- View individual spam
- Approve/dispprove a specific spam
From the user pages, a group member can
- Set his/her persoanl email preference
- Send spam to group members
- Send spam to group administrators
- View his/her own spam history
- View individual spam
ahmeds@mit.edu