Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Managing Email Aliases

Give your users the ability to secure their real email addresses behind Email Aliases.

Email Aliases can be provisioned for different configured domains to provide more options to your users. To provision an Email Alias the sequence is:

  1. Retrieve the list of available domains

  2. Check if the desired alias address for a given domain is valid and available

  3. Provision the Email Alias address

Get Email Alias Domains

The Sudo Platform Email Service can be configured to support multiple domains for your email aliasing needs.

Each project in your Sudo Platform account can be configured to support a set of email domains. Your solutions engineer can assist you in configuring DNS entries for domains you own or you can have the Sudo Platform do that on your behalf.

A call to the listEmailDomains method provides the configured domains along with metadata about each one. To find the domains that are available for provisioning Email Aliases, filter the results where isAliasDomain == true.

try {
    const domains = await emailClient.listEmailDomains()
    const aliasDomains = domains.filter(d => d.isAliasDomain)
    // `aliasDomains` contains an array of supported domains to be used for provisioning Email Aliases
} catch (e) {
    // Handle/notify user of errors
}
do {
    let domains = try await client.listEmailDomains()
    let aliasDomains = domains.filter { $0.isAliasDomain }
    // `aliasDomains` contains a list of domains available for provisioning Email Aliases
} catch {
    /// Handle/notify user of errors
}
launch {
    try {
        val domains = withContext(Dispatchers.IO) {
            emailClient.listEmailDomains()
        }
        val aliasDomains = domains.filter { it.isAliasDomain }
        // [aliasDomains] contains a list of configured domains for provisioning Email Aliases.
    } catch (e: EmailAddressException) {
        // Handle/notify user of exception
    }
 }

Check Email Alias Availability

In order to ensure your users can choose a unique, available, address for their Email Alias, you can use the same checkEmailAddressAvailability method as you would for a regular Sudo Platform email address. More information on that method can be found here.

Provision Email Alias

Once your user has the address they would like to use for their Email Alias, it can be provisioned. The provisionEmailAlias method will return the newly provisioned Email Alias object.

An ownershipProofToken is required as part of the input. This ties together the Sudo and Email Alias such that the Sudo becomes the owner of the Alias. Use the getOwnershipProof method on the SudoProfilesClient in the Sudo Profiles SDK in order to obtain an ownershipProofToken. See the Sudo section for more information.

Verify Real Address Ownership

The realAddress property of the input must be the exact local-part@domain email address that the alias should forward to. For Sudo Platform Email Addresses, the address must be owned by the same user trying to provision the Alias.

If your use case requires to allow your users to set up Aliases for external email addresses, then the Alias that is provisioned will initially have its state set to PENDING. While in this state, it cannot receive messages. In order to change the state to ENABLED, the user must verify ownership of their external email address. See Verifying External Email Addresses.

Entitlements

In order to be able to provision an Email Alias, the user must be entitled. The following entitlement checks are performed:

  1. The user is entitled to provision Email Aliases by the sudoplatform.email.emailAliasUserEntitled entitlement.

  2. The user against which the new email address is to be provisioned has at least 1 remaining sudoplatform.email.emailAliasMaxPerUser entitlement to consume.

If these entitlements' checks do not succeed, the provisionEmailAlias API fails with an insufficient entitlements error.

See Email Entitlements for an overview of how the Email service integrates with the Sudo Platform Entitlements system.

Optional Parameters

The provisionEmailAlias method's input object can take up to two additional optional parameters:

  1. expiresAt - If set, the alias will automatically be deprovisioned at the given date.

  2. metadata - This is a string to string map that can be used to store information about the Email Alias such as the purpose of it. The data in this property gets encrypted with the user's default key pair before being sent to the server, and decrypted upon retrieval.

Both of these optional properties can be updated, or deleted via the updateEmailAlias method.

Deprovision Email Alias

An Email Alias can be deprovisioned using the deprovisionEmailAlias method by passing in the id of an existing Email Alias object.

Updating an Email Alias

An existing email alias can have a subset of its data updated by the user by calling the updateEmailAlias method. The properties that can be updated are outlined in the table below.

Property
To ignore
To delete
Notes

expiresAt

TypeScript: undefined (or exclude from object) Swift: nil Kotlin: null

Typescript: null Swift: Date(timeIntervalSince1970: 0) Kotlin: Date(0)

metadata

TypeScript: undefined (or exclude from object) Swift: nil Kotlin: null

Typescript: null Swift: [:] Kotlin: emptyMap()

realAddress

TypeScript: undefined (or exclude from object) Swift: nil Kotlin: null

N/A

This property can only be updated for Email Aliases with an external real address that have not yet been verified.

Retrieving Existing Email Aliases

Previously provisioned Email Aliases can be retrieved as a paginated list via the listEmailAliasesForOwner method.

A call to the API will return a ListOutput<EmailAlias> object. The items property will contain a list of the aliases and the nextToken property will contain a token that can be used for retrieving the next page of results if there are more.

The list can also be filtered by passing in an optional filter property to the method call. The call can be filtered by status and/or realAddressType. Each of those must further be specified as either equal, oneOf, notEqual or notOneOf.

The list can also be given a limit on how many results to return. By default, this limit is 10.

Disabling and Enabling Email Aliases

An Email Alias can be disabled by the user to temporarily stop it from receiving emails without fully deprovisioning it. While in the DISABLED state, messages sent to the alias will not be delivered to the real address, and the sender will not receive a bounce in response until it is enabled again.

Last updated