diff --git a/app/controllers/web/my-account/validate-alias.js b/app/controllers/web/my-account/validate-alias.js index e74f215e34..844ddead03 100644 --- a/app/controllers/web/my-account/validate-alias.js +++ b/app/controllers/web/my-account/validate-alias.js @@ -78,6 +78,8 @@ function validateAlias(ctx, next) { ); else body.recipients = []; + if (_.isEmpty(body.recipients)) body.recipients = [ctx.state.user.email]; + ctx.state.body = body; return next(); diff --git a/app/views/api/index.md b/app/views/api/index.md index 738323bb8d..44cea464ba 100644 --- a/app/views/api/index.md +++ b/app/views/api/index.md @@ -355,14 +355,14 @@ curl -X GET BASE_URI/v1/domains/DOMAIN_NAME/aliases \ > `POST /v1/domains/DOMAIN_NAME/aliases` -| Body Parameter | Required | Type | Description | -| ---------------------------- | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | No | String | Alias name (if not provided or if blank, then a random alias is generated) | -| `recipients` | Yes | String or Array | List of recipients (must be line-break/space/comma separated String or Array of valid email addresses, fully-qualified domain names ("FQDN"), IP addresses, and/or webhook URL's) | -| `description` | No | String | Alias description | -| `labels` | No | String or Array | List of labels (must be line-break/space/comma separated String or Array) | -| `has_recipient_verification` | No | Boolean | Whether to enable to require recipients to click an email verification link for emails to flow through (defaults to the domain's setting if not explicitly set in the request body) | -| `is_enabled` | No | Boolean | Whether to enable to disable this alias (if disabled, emails will be routed nowhere but return successful status codes) | +| Body Parameter | Required | Type | Description | +| ---------------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | No | String | Alias name (if not provided or if blank, then a random alias is generated) | +| `recipients` | No | String or Array | List of recipients (must be line-break/space/comma separated String or Array of valid email addresses, fully-qualified domain names ("FQDN"), IP addresses, and/or webhook URL's – and if not provided or is an empty Array, then the user's email making the API request will be set as the recipient) | +| `description` | No | String | Alias description | +| `labels` | No | String or Array | List of labels (must be line-break/space/comma separated String or Array) | +| `has_recipient_verification` | No | Boolean | Whether to enable to require recipients to click an email verification link for emails to flow through (defaults to the domain's setting if not explicitly set in the request body) | +| `is_enabled` | No | Boolean | Whether to enable to disable this alias (if disabled, emails will be routed nowhere but return successful status codes) | > Example Request: