Your CRM is only as good as the data in it. Most sales teams lose deals because contacts go stale, emails aren't logged, and relationship context lives in individual inboxes instead of the CRM.
Manually copy-pasting email data into Salesforce, HubSpot, or Pipedrive doesn't scale. Native email sync features from CRM vendors are expensive add-ons. Building custom integrations against Gmail API or Microsoft Graph takes weeks.
Nylas CLI extracts structured email and contact data from any provider (Gmail, Outlook, Exchange, Yahoo, iCloud, IMAP) and exports it in formats every CRM can ingest — CSV for bulk import, JSON for API sync, or direct API calls.
Install and authenticate
brew install nylas/nylas-cli/nylas
nylas auth login
Full setup: Getting Started with Nylas CLI
Extract contacts from your inbox
Every email contains contact data. Pull it out:
# Get all unique senders from recent emails
nylas email list --json --limit 500 | \
jq -r '.[].from[0] | "\(.email),\(.name // "")"' | \
sort -u > contacts.csv
# Get contacts with email frequency (who emails you most)
nylas email list --json --limit 1000 | \
jq -r '.[].from[0].email' | sort | uniq -c | sort -rn > contact-frequency.csv
For advanced contact enrichment from email signatures: Parse Email Signatures for Contact Enrichment
Group emails by company domain
Identify which organizations email you most:
# Extract corporate domains (filter out freemail)
nylas email list --json --limit 500 | \
jq -r '.[].from[0].email' | \
awk -F@ '{print $2}' | \
grep -vE 'gmail|yahoo|hotmail|outlook\.com' | \
sort | uniq -c | sort -rn | head -20
Full guide: Group Inbox by Corporate Email Domain
Export to Salesforce
CSV import (bulk)
# Generate Salesforce-compatible Lead CSV
nylas email list --json --limit 500 | \
jq -r '.[].from[0] | [.name // "", .email, (.email | split("@")[1])] | @csv' \
> salesforce-leads.csv
# Add headers
sed -i '1i\Name,Email,Company' salesforce-leads.csv
Upload via Salesforce Data Import Wizard or Data Loader.
API sync (real-time)
import subprocess
import json
import requests
# Fetch recent contacts from email
result = subprocess.run(
["nylas", "email", "list", "--json", "--limit", "100"],
capture_output=True, text=True
)
emails = json.loads(result.stdout)
# Upsert to Salesforce
for email in emails:
sender = email["from"][0]
requests.post(
"https://your-instance.salesforce.com/services/data/v58.0/sobjects/Lead/",
headers={"Authorization": f"Bearer {SF_TOKEN}"},
json={
"Email": sender["email"],
"LastName": sender.get("name", "Unknown"),
"Company": sender["email"].split("@")[1]
}
)
Full guide: Export Email Data to Salesforce
Export to HubSpot
# Upsert contacts to HubSpot
for email in emails:
sender = email["from"][0]
requests.post(
"https://api.hubapi.com/crm/v3/objects/contacts",
headers={"Authorization": f"Bearer {HUBSPOT_TOKEN}"},
json={
"properties": {
"email": sender["email"],
"firstname": sender.get("name", "").split()[0] if sender.get("name") else "",
"lastname": sender.get("name", "").split()[-1] if sender.get("name") else "",
"company": sender["email"].split("@")[1]
}
}
)
Full guide: Export Email Data to HubSpot
Export to Pipedrive
Full guide: Export Email Data to Pipedrive
Export to Zoho CRM
Full guide: Export Email Data to Zoho CRM
Export to Dynamics 365
Full guide: Export Email Data to Dynamics 365
Build org charts from CC patterns
Who CCs whom reveals reporting lines. A manager is usually CC'd on reports from their team:
# Extract CC relationships
nylas email list --json --limit 500 | \
jq -r '.[] | select(.cc != null) |
.from[0].email as $from |
.cc[].email as $cc |
"\($from) -> \($cc)"' | \
sort | uniq -c | sort -rn
Full guide: Reconstruct Org Charts from Email CC Patterns
Score relationship strength
Not all contacts are equal. Measure relationship strength by email frequency, response time, and recency:
# Emails per contact in the last 30 days
nylas email list --after "30 days ago" --json --limit 1000 | \
jq -r '.[].from[0].email' | sort | uniq -c | sort -rn
Full guide: Visualize Communication Patterns Between Organizations
Automate outbound with mail merge
Once your CRM data is enriched, send personalized outreach:
# Bulk send from CSV
while IFS=, read -r email name company; do
nylas email send \
--to "$email" \
--subject "Quick question about $company" \
--body "Hi $name, I noticed we've been exchanging emails..." \
--yes
sleep 2
done < outreach-list.csv
Full guide: CLI Mail Merge
For draft-based workflows with review steps: Automate Email Draft Creation
Build a fuzzy email autocomplete
Speed up email composition with contact autocomplete:
# Generate a contact frequency list for autocomplete
nylas email list --json --limit 2000 | \
jq -r '.[].from[0] | "\(.name // "") <\(.email)>"' | \
sort | uniq -c | sort -rn > ~/.email-contacts
Full guide: Build Shell-Integrated Email Autocomplete
Graph analysis with Neo4j
For advanced relationship mapping, import email data into a graph database:
# Export sender-recipient pairs for Neo4j import
nylas email list --json --limit 1000 | \
jq -r '.[] | .from[0].email + "," + (.to[0].email // "unknown")' \
> email-edges.csv
Full guide: Model Email as a Graph: Neo4j and Network Analysis
Works with any email provider
All CRM workflows work across Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP. No provider-specific code:
Full guide with company mapping, relationship scoring, and CRM sync patterns: CRM Email Workflows
Related guides:
- Send Email from the Command Line
- Build an AI Email Triage Agent
- Email as Memory for AI Agents
- Give Your AI Agent an Email Address
- Automated Email Reports with PowerShell
- Best CLI Email Tools Compared
- Secure Email Handling for CLI
All guides: cli.nylas.com/guides
Top comments (0)