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.

20 properties
Schema

Properties

PropertyTypeModeDescriptionRequired
userIduuid
stored

User who owns this email address

Required
emailstring
stored

The email address

Required
emailTypestring
enum

Purpose of this email address

Values: primary, secondary, recovery, notification, billing, work, personal

Optional
isVerifiedboolean
stored

Whether ownership of this email has been confirmed

Optional
verifiedAtDateTime
stored

When the email verification was completed

Optional
verificationTokenstring
stored

Unique token sent to email for verification

Optional
verificationSentAtDateTime
stored

When the verification email was sent

Optional
verificationAttemptsinteger
stored

Number of verification emails sent

Optional
verificationExpiresAtDateTime
stored

When the verification token expires

Optional
isPrimaryboolean
stored

Whether this is the main contact email

Optional
canReceiveNotificationsboolean
stored

Whether to send notifications to this address

Optional
notificationPreferencesstring
stored

JSON object of notification types allowed for this email

Example: "{\"marketing\":false,\"security\":true,\"updates\":true}"

Optional
canBeUsedForLoginboolean
stored

Whether this email can be used as username for login

Optional
canBeUsedForRecoveryboolean
stored

Whether password resets can be sent here

Optional
addedAtDateTime
stored

When this email was added to the account

Required
addedBystring
enum

How this email was added

Values: user, admin, system, import, oauth

Optional
lastUsedAtDateTime
stored

Last time this email was used for any operation

Optional
bounceCountinteger
stored

Number of email delivery failures

Optional
isBlacklistedboolean
stored

Whether this email is blocked due to bounces or complaints

Optional
metadatastring
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\"}"
}