Skip to main content
POST
/
user
/
email-accounts
Connect Email Account
curl --request POST \
  --url https://api.lemlist.com/api/user/email-accounts \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sender_name": "John Doe",
  "sender_email": "john@company.com",
  "smtp_host": "smtp.company.com",
  "smtp_port": 587,
  "smtp_login": "john@company.com",
  "smtp_password": "password123",
  "imap_host": "imap.company.com",
  "imap_port": 993,
  "imap_login": "john@company.com",
  "imap_password": "password123"
}
'
{
  "id": "umx_A1B2C3D4E5F6G7H8I9",
  "email": "john@company.com",
  "provider": "custom"
}
Connects a custom SMTP/IMAP email account that can be used as a sender in your campaigns. The account is validated against banned hosts and SSRF checks before being connected. Gmail SMTP/IMAP connections are not allowed — use OAuth instead.

Examples

{
  "sender_name": "John Doe",
  "sender_email": "john@company.com",
  "smtp_host": "smtp.company.com",
  "smtp_port": 587,
  "smtp_login": "john@company.com",
  "smtp_password": "password123",
  "imap_host": "imap.company.com",
  "imap_port": 993,
  "imap_login": "john@company.com",
  "imap_password": "password123"
}
The userId parameter is optional. When provided, the email account is assigned to that specific team member (who must belong to the team). When omitted, it defaults to the API key creator or team owner.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json
sender_name
string
required

Display name for the sender.

Example:

"John Doe"

sender_email
string<email>
required

Email address used as the sender.

Example:

"john@company.com"

smtp_host
string
required

SMTP server hostname.

Example:

"smtp.company.com"

smtp_port
integer
required

SMTP server port.

Example:

587

smtp_login
string
required

SMTP authentication login.

Example:

"john@company.com"

smtp_password
string
required

SMTP authentication password.

Example:

"password123"

imap_host
string
required

IMAP server hostname.

Example:

"imap.company.com"

imap_port
integer
required

IMAP server port.

Example:

993

imap_login
string
required

IMAP authentication login.

Example:

"john@company.com"

imap_password
string
required

IMAP authentication password.

Example:

"password123"

smtp_secure
boolean
default:false

Use SSL/TLS for SMTP connection.

imap_secure
boolean
default:false

Use SSL/TLS for IMAP connection.

userId
string

Assign the email account to a specific team member. Must be a member of the team. Defaults to the API key creator or team owner.

Response

Email account connected successfully

id
string

Unique identifier of the created email account.

email
string<email>

The sender email address.

provider
string

Always custom for SMTP/IMAP accounts.

Example:

"custom"