Set email inbox

Sets the email inbox for your server.

Requires the user to havemanage-email-inboxpermission.

URLRequires AuthHTTP Method

/api/v1/email-inbox

yes

POST

Payload

ArgumentExampleRequiredDescription

_id

Qe3Wa3outaDMKzAZC

Optional

Email Id.

name

My-new-email

Required

The name you wish to set for your email.

email

mdyemaasil@rocket.chat

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": "mdyemaasil@rocket.chat",
    "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": "myinboxemail@rocket.chat",
    "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.

{
    "success": false,
    "error": "unauthorized"
}

Change Log

VersionDescription

3.11.0-rc.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.