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 fields""The authentication you supplied is incorrect""User is not a member of this team"Connect Email Account
Connects a new SMTP/IMAP email account to your team.
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 fields""The authentication you supplied is incorrect""User is not a member of this team"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"
}
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
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
Display name for the sender.
"John Doe"
Email address used as the sender.
"john@company.com"
SMTP server hostname.
"smtp.company.com"
SMTP server port.
587
SMTP authentication login.
"john@company.com"
SMTP authentication password.
"password123"
IMAP server hostname.
"imap.company.com"
IMAP server port.
993
IMAP authentication login.
"john@company.com"
IMAP authentication password.
"password123"
Use SSL/TLS for SMTP connection.
Use SSL/TLS for IMAP connection.
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.
Was this page helpful?