Links

Set email inbox

Sets the email inbox for your server.
Requires the user to havemanage-email-inboxpermission.
URL
Requires Auth
HTTP Method
/api/v1/email-inbox
yes
POST

Payload

Argument
Example
Required
Description
_id
Qe3Wa3outaDMKzAZC
Optional
Email Id.
name
My-new-email
Required
The name you wish to set for your email.
email
Required
The email to be used
active
true
Required
Set whether or not the email is active.
description
A simple email to use
Optional
The description for this entry.
senderInfo
email sender
Optional
Sender info to be attached on outgoing emails.
department
marketing
Optional
The department in which the email will be available to.
smtp
{ "password": "10fae4dc374fb87d", "port": 25, "secure": true, "server": "smtp.mailtrap.io", "username": "b5ef5safd6cb806c" }
Required
An object with your SMTP credentials to be used for outgoing emails.
imap
{ "password": "10fae4374sdfb87d", "port": 993, "secure": true, "server": "imap.mailtrap.io", "username": "b5ef5aafd6cb806c" }
Required
An object having your IMAP credentials to be used for incomming emails.

Example Payload

{
"name": "new email",
"email": "[email protected]",
"active": false,
"description": "This email has been set",
"senderInfo": "email sender",
"department": "awesome department",
"smtp": {
"password": "10fae4dc374fb87d",
"port": 25,
"secure": true,
"server": "smtp.mailtrap.io",
"username": "b5ef5safd6cb806c"
},
"imap": {
"password": "10fae4374sdfb87d",
"port": 993,
"secure": true,
"server": "imap.mailtrap.io",
"username": "b5ef5aafd6cb806c"
}
}

Example Call

curl -L -X POST 'http://localhost:3000/api/v1/email-inbox' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92' \
-H 'Content-Type: application/json' \
--data-raw '{
"_id": "JdVkn_dkOlms_",
"name": "my_new_email",
"email": "[email protected]",
"active": false,
"smtp": {
"password": "10fae4dc374fb87d",
"port": 25,
"secure": true,
"server": "smtp.mailtrap.io",
"username": "b5ef5safd6cb806c"
},
"imap": {
"password": "10fae4374sdfb87d",
"port": 993,
"secure": true,
"server": "imap.mailtrap.io",
"username": "b5ef5aafd6cb806c"
}
}'

Result

Success

{
"_id": "JdVkn_dkOlms_",
"success": true
}

Errors

The following error can occur upon the endpoint.
  • Authorization: Requires an authentication token for the request to be made.
  • Permission: Requires the user to have manage-email-inbox permission for the request to be made.
  • Duplicate: You get a duplicate error when the email you are trying to set is already in record.
Authorization
Permission
Duplicate
Invalid Inbox
{
"success": false,
"error": "unauthorized"
}
{
"success": false,
"error": "error-not-allowed"
}
{
"success": false,
"error": "E11000 duplicate key error index: rocketchat.rocketchat_email_inbox.$email_1 dup key: { : \"[email protected]\" }"
}
{
"success": false,
"error": "error-invalid-email-inbox"
}

Change Log

Version
Description
3.11.0-rc.0
Added
Last modified 1yr ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.