# User Preferences

## User Email Preferences

Allow users to control their email subscriptions and notification settings to improve engagement and comply with privacy regulations.

### Overview

The user email preferences system enables:

* **Individual Control**: Users manage their own email settings
* **Granular Options**: Different notification types can be toggled independently
* **Privacy Compliance**: Respects user consent and preferences
* **Easy Management**: Simple interface for preference updates
* **Bulk Controls**: Option to unsubscribe from non-essential emails

### Accessing Email Preferences

#### For Users

1. Navigate to **Profile** page from the dashboard
2. Look for the **"Email Preferences"** section
3. Toggle individual preference switches as desired
4. Changes are saved automatically

#### For Administrators

Administrators can view (but not modify) user preferences through:

* User management interfaces
* Analytics dashboards showing preference trends
* Bulk email sender (respects user preferences automatically)

### Email Preference Categories

#### Newsletter Subscription

**Purpose**: Weekly newsletter with DAO updates and insights**Default**: Enabled for new users**User Control**: Can be disabled at any time**Impact**: Users won't receive newsletter emails when disabled

**Content Includes**:

* DAO community updates
* Weekly governance summary
* Member spotlights
* Educational content
* Industry news relevant to the DAO

#### Governance Notifications

**Purpose**: Updates about proposals, voting, and governance activities**Default**: Enabled for new users**User Control**: Can be disabled, but not recommended for active members**Impact**: Users may miss important voting opportunities

**Content Includes**:

* New proposal notifications
* Voting deadlines and reminders
* Proposal status updates
* Governance process changes
* Community discussions

#### Transaction Notifications

**Purpose**: Confirmations and updates for financial transactions**Default**: Enabled for new users**User Control**: Can be disabled (not recommended)**Impact**: Users won't receive purchase confirmations, staking updates

**Content Includes**:

* Token purchase confirmations
* Staking transaction confirmations
* Reward distribution notifications
* Payment processing updates
* Wallet connection confirmations

#### Security Notifications

**Purpose**: Important security alerts and account changes**Default**: Enabled for new users (strongly recommended to keep enabled)**User Control**: Can be disabled (strongly discouraged)**Impact**: Users may miss critical security information

**Content Includes**:

* Password reset requests
* Account login notifications
* Security setting changes
* Suspicious activity alerts
* Two-factor authentication updates

#### Marketing Emails

**Purpose**: Promotional content, product updates, and special offers**Default**: Disabled for new users (opt-in required)**User Control**: Full control (opt-in/opt-out)**Impact**: Users won't receive promotional communications

**Content Includes**:

* Product announcements
* Special promotions
* Partnership announcements
* Event invitations
* Educational webinars

### Preference Management Interface

#### Individual Toggles

Each preference category features:

* **Switch Control**: Easy on/off toggle
* **Category Icon**: Visual identifier for each type
* **Description Text**: Clear explanation of what emails are included
* **Color Coding**: Different colors for each category type

**Visual Design**:

* Newsletter: Blue megaphone icon
* Governance: Green bell icon
* Transactions: Purple dollar sign icon
* Security: Red shield icon
* Marketing: Orange mail icon

#### Bulk Actions

**Unsubscribe from All Non-Essential**: Quick action to disable most email types

* Disables: Newsletter, governance, marketing emails
* Keeps enabled: Security notifications, transaction confirmations
* One-click convenience for users who want minimal emails

#### Auto-Save Functionality

* Changes save automatically when toggled
* No submit button required
* Immediate feedback with toast notifications
* Loading states during save operations

### Default Settings for New Users

When new users join the platform:

```
Newsletter: ✓ Enabled
Governance: ✓ Enabled  
Transactions: ✓ Enabled
Security: ✓ Enabled
Marketing: ✗ Disabled (requires opt-in)
```

This configuration ensures:

* Users receive important operational information
* Marketing requires explicit consent
* Users can immediately adjust preferences
* Compliance with email regulations

### Privacy and Compliance

#### GDPR Compliance

**Consent Management**:

* Clear descriptions of email types
* Easy opt-out mechanisms
* Granular control over data usage
* Explicit consent for marketing emails

**Data Subject Rights**:

* Users can view their current preferences
* Full control over email subscriptions
* Easy unsubscribe options
* Data deletion requests honored

#### CAN-SPAM Act Compliance

**Required Elements**:

* Clear identification of sender
* Honest subject lines
* Physical address disclosure
* Easy unsubscribe mechanism
* Prompt processing of opt-out requests

#### Double Opt-In (Optional)

For marketing emails, consider implementing:

* Confirmation email for marketing opt-ins
* Verification of email address ownership
* Documentation of consent timestamp
* Audit trail for compliance purposes

### Integration with Email Sending

#### Automatic Filtering

When sending emails, the system automatically:

1. **Checks user preferences**: Before adding recipients to send lists
2. **Filters by category**: Only includes users who opted in for that email type
3. **Respects bulk unsubscribe**: Honors "unsubscribe all" selections
4. **Maintains audit trail**: Logs preference-based filtering decisions

#### Bulk Email Sender Integration

The bulk email sender respects preferences by:

* **Pre-filtering recipients**: Removes users who opted out of relevant categories
* **Showing filtered counts**: Displays how many users were excluded
* **Category matching**: Maps email templates to preference categories
* **Override protection**: Prevents sending to opted-out users

#### Template-to-Preference Mapping

| Template Type           | Preference Category | Behavior                          |
| ----------------------- | ------------------- | --------------------------------- |
| `newsletter`            | Newsletter          | Filtered by newsletter preference |
| `new_proposal`          | Governance          | Filtered by governance preference |
| `voting_reminder`       | Governance          | Filtered by governance preference |
| `purchase_confirmation` | Transactions        | Always sent (essential)           |
| `security_alert`        | Security            | Always sent (critical)            |
| `marketing_promo`       | Marketing           | Filtered by marketing preference  |

### Analytics and Reporting

#### Preference Statistics

Track user preference trends:

* **Opt-in rates**: Percentage of users enabling each category
* **Opt-out trends**: Which preferences are disabled most often
* **Segmentation data**: User engagement by preference settings
* **Compliance metrics**: Marketing consent rates

#### Preference Impact Analysis

Monitor how preferences affect:

* **Email delivery volume**: Reduction due to user opt-outs
* **Engagement rates**: Whether targeted users engage more
* **Unsubscribe rates**: If granular control reduces global unsubscribes
* **User satisfaction**: Feedback on preference control

### Best Practices

#### User Experience

1. **Clear labeling**: Make preference purposes obvious
2. **Immediate feedback**: Show when preferences are saved
3. **Easy access**: Link to preferences from all emails
4. **Mobile friendly**: Ensure preferences work on all devices

#### Communication Strategy

1. **Respect choices**: Honor preferences consistently
2. **Value proposition**: Explain benefits of staying subscribed
3. **Frequency control**: Don't overwhelm even opted-in users
4. **Quality content**: Make emails worth subscribing to

#### Technical Implementation

1. **Real-time updates**: Preferences take effect immediately
2. **Backup preferences**: Maintain preference history
3. **System integration**: All email systems check preferences
4. **Error handling**: Graceful degradation if preference system is unavailable

### Troubleshooting

#### Users Still Receiving Unwanted Emails

**Check**:

1. Preference settings are correctly saved
2. Email templates are properly categorized
3. Bulk sender respects preference filters
4. No override flags are set inappropriately

#### Preferences Not Saving

**Investigate**:

1. Database connectivity issues
2. User authentication problems
3. Browser compatibility issues
4. Network connectivity problems

#### Missing Preference Options

**Verify**:

1. User interface is displaying all categories
2. Database schema includes all preference fields
3. User has proper permissions to view preferences
4. No errors in preference loading logic

### Migration and Updates

#### Adding New Preference Categories

When adding new email types:

1. **Update database schema**: Add new preference fields
2. **Set sensible defaults**: Usually disabled for existing users
3. **Update user interface**: Add new toggle controls
4. **Map to email templates**: Connect templates to new preferences
5. **Communicate changes**: Inform users about new controls

#### Modifying Existing Categories

When changing preference behavior:

1. **Communicate changes**: Notify users in advance
2. **Preserve user choices**: Don't reset existing preferences
3. **Update documentation**: Keep user guides current
4. **Test thoroughly**: Ensure changes work as expected

This comprehensive preference system ensures users have full control over their email experience while maintaining essential communications and regulatory compliance.
