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"
}
'import requests
url = "https://api.lemlist.com/api/user/email-accounts"
payload = {
"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"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://api.lemlist.com/api/user/email-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/user/email-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sender_name\": \"John Doe\",\n \"sender_email\": \"john@company.com\",\n \"smtp_host\": \"smtp.company.com\",\n \"smtp_port\": 587,\n \"smtp_login\": \"john@company.com\",\n \"smtp_password\": \"password123\",\n \"imap_host\": \"imap.company.com\",\n \"imap_port\": 993,\n \"imap_login\": \"john@company.com\",\n \"imap_password\": \"password123\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/user/email-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "umx_A1B2C3D4E5F6G7H8I9",
"email": "john@company.com",
"provider": "custom"
}Missing required fieldsThe authentication you supplied is incorrectUser is not a member of this teamEmail Accounts
Connect Email Account
Connects a new SMTP/IMAP email account to your team.
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"
}
'import requests
url = "https://api.lemlist.com/api/user/email-accounts"
payload = {
"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"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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'
})
};
fetch('https://api.lemlist.com/api/user/email-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/user/email-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sender_name\": \"John Doe\",\n \"sender_email\": \"john@company.com\",\n \"smtp_host\": \"smtp.company.com\",\n \"smtp_port\": 587,\n \"smtp_login\": \"john@company.com\",\n \"smtp_password\": \"password123\",\n \"imap_host\": \"imap.company.com\",\n \"imap_port\": 993,\n \"imap_login\": \"john@company.com\",\n \"imap_password\": \"password123\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/user/email-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "umx_A1B2C3D4E5F6G7H8I9",
"email": "john@company.com",
"provider": "custom"
}Missing required fieldsThe authentication you supplied is incorrectUser is not a member of this teamConnects 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"
}
{
"sender_name": "John Doe",
"sender_email": "john@company.com",
"smtp_host": "smtp.company.com",
"smtp_port": 465,
"smtp_login": "john@company.com",
"smtp_password": "password123",
"smtp_secure": true,
"imap_host": "imap.company.com",
"imap_port": 993,
"imap_login": "john@company.com",
"imap_password": "password123",
"imap_secure": true,
"userId": "usr_A1B2C3D4E5F6G7H8I9"
}
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
Body
application/json
Was this page helpful?