Adds a new email alias to a user account..
12345
The ID of the user.
"alias@example.com"
The email address to add to the account as an alias.
Note: The domain of the email alias needs to be registered to your enterprise. See the domain verification guide for steps to add a new domain.
Returns the newly created email alias object.
An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/users/12345/email_aliases" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"email": "alias@example.com"
}'
await client.emailAliases.createUserEmailAlias(newUser.id, {
email: newAliasEmail,
} satisfies CreateUserEmailAliasRequestBody);
client.email_aliases.create_user_email_alias(new_user.id, new_alias_email)
await client.EmailAliases.CreateUserEmailAliasAsync(userId: newUser.Id, requestBody: new CreateUserEmailAliasRequestBody(email: newAliasEmail));
BoxUser user = new BoxUser(api, "0");
user.addEmailAlias("user+alias@example.com");
user_id = '33333'
user = client.user(user_id)
email_alias = user.add_email_alias('alias@example.com')
BoxEmailAlias alias = await client.UsersManager
.AddEmailAliasAsync(userId: "33333", email: "user+foo@example.com");
client.users.addEmailAlias('33333', 'user+baz@example.com')
.then(alias => {
/* alias -> {
type: 'email_alias',
id: '12345',
is_confirmed: false,
email: 'user+baz@example.com' }
*/
});
client.users.createEmailAlias(
userId: "33333",
email: "user+alias@example.com"
) { (result: Result<EmailAlias, BoxSDKError>) in
guard case let .success(alias) = result else {
print("Error adding email alias")
return
}
print("Added email alias \(alias.email) — user must confirm")
}
{
"id": "11446498",
"type": "email_alias",
"email": "alias@example.com",
"is_confirmed": true
}