UserEmail
Manages multiple email addresses for a single user account, supporting various use cases like work emails, personal emails, and recovery addresses. Modern users often have multiple email addresses they use for different purposes - this entity allows them to associate all these addresses with their account while maintaining one as primary. Each email can serve different functions: the primary email for login and important notifications, secondary emails for specific types of communications, recovery emails for account access issues, and notification-only emails for subscriptions or alerts. The entity tracks verification status for each email independently, as users must prove ownership before an email can be used for authentication or sensitive operations. This multi-email support is essential for professional users who might change jobs but want to maintain account access, or for users who want different notification types sent to different addresses (bills to personal email, newsletters to a dedicated inbox). The system ensures email uniqueness across all users - no two accounts can claim the same email address. When users change their primary email, the old one can be retained as secondary for account recovery purposes, providing a safety net against account lockouts.
Properties
| Property | Type | Mode | Description | Required |
|---|---|---|---|---|
| userId | uuid | stored | User who owns this email address | Required |
| string | stored | The email address | Required | |
| emailType | string | enum | Purpose of this email address Values: | Optional |
| isVerified | boolean | stored | Whether ownership of this email has been confirmed | Optional |
| verifiedAt | DateTime | stored | When the email verification was completed | Optional |
| verificationToken | string | stored | Unique token sent to email for verification | Optional |
| verificationSentAt | DateTime | stored | When the verification email was sent | Optional |
| verificationAttempts | integer | stored | Number of verification emails sent | Optional |
| verificationExpiresAt | DateTime | stored | When the verification token expires | Optional |
| isPrimary | boolean | stored | Whether this is the main contact email | Optional |
| canReceiveNotifications | boolean | stored | Whether to send notifications to this address | Optional |
| notificationPreferences | string | stored | JSON object of notification types allowed for this email Example: | Optional |
| canBeUsedForLogin | boolean | stored | Whether this email can be used as username for login | Optional |
| canBeUsedForRecovery | boolean | stored | Whether password resets can be sent here | Optional |
| addedAt | DateTime | stored | When this email was added to the account | Required |
| addedBy | string | enum | How this email was added Values: | Optional |
| lastUsedAt | DateTime | stored | Last time this email was used for any operation | Optional |
| bounceCount | integer | stored | Number of email delivery failures | Optional |
| isBlacklisted | boolean | stored | Whether this email is blocked due to bounces or complaints | Optional |
| metadata | string | stored | Additional data about this email address | Optional |
Examples
Example 1
{
"@type": "UserEmail",
"userId": "user_550e8400",
"email": "john.smith@techcorp.com",
"emailType": "work",
"isVerified": true,
"verifiedAt": "2024-01-15T10:30:00Z",
"verificationAttempts": 1,
"isPrimary": true,
"canReceiveNotifications": true,
"notificationPreferences": "{\"marketing\":true,\"security\":true,\"updates\":true,\"billing\":true}",
"canBeUsedForLogin": true,
"canBeUsedForRecovery": true,
"addedAt": "2024-01-15T10:00:00Z",
"addedBy": "user",
"lastUsedAt": "2024-03-15T14:30:00Z",
"bounceCount": 0,
"isBlacklisted": false
}Example 2
{
"@type": "UserEmail",
"userId": "user_550e8400",
"email": "jsmith.personal@gmail.com",
"emailType": "personal",
"isVerified": true,
"verifiedAt": "2024-02-01T09:00:00Z",
"verificationAttempts": 2,
"isPrimary": false,
"canReceiveNotifications": true,
"notificationPreferences": "{\"marketing\":false,\"security\":true,\"updates\":false,\"billing\":true}",
"canBeUsedForLogin": false,
"canBeUsedForRecovery": true,
"addedAt": "2024-02-01T08:30:00Z",
"addedBy": "user",
"lastUsedAt": "2024-03-10T11:00:00Z",
"bounceCount": 0,
"isBlacklisted": false,
"metadata": "{\"provider\":\"gmail\",\"preferred_for\":\"personal_receipts\"}"
}