AI Agents for Email
Leverage AI to create, optimize, and personalize your email content.
AI Content Generation
Generate email content using natural language prompts:
const content = await lettr . ai . generateContent ({
prompt: 'Write a welcome email for a SaaS product' ,
tone: 'friendly' ,
length: 'medium'
});
console . log ( content . subject ); // Generated subject line
console . log ( content . html ); // Generated HTML content
Available AI Features
Subject Line Generator Generate compelling subject lines that improve open rates.
Content Writer Create full email content from prompts.
Translation Translate emails to different languages.
Tone Adjustment Adjust tone from formal to casual.
Generate Subject Lines
const subjects = await lettr . ai . generateSubjects ({
content: 'We are launching a new feature that helps users save time' ,
count: 5 ,
style: 'engaging'
});
// Returns array of subject lines:
[
"🚀 Save Hours Every Week with Our New Feature" ,
"Your Time-Saving Solution Has Arrived" ,
"New Feature Alert: Work Smarter, Not Harder" ,
"Introducing the Feature You've Been Waiting For" ,
"Ready to Reclaim Your Time?"
]
Improve Existing Content
Optimize your email content:
const improved = await lettr . ai . improve ({
html: existingEmailHtml ,
goals: [ 'clarity' , 'engagement' , 'conversion' ]
});
console . log ( improved . html );
console . log ( improved . suggestions );
Personalization
Generate personalized content at scale:
await lettr . emails . send ({
from: 'you@example.com' ,
to: [ 'recipient@example.com' ],
subject: 'Your Personalized Recommendations' ,
aiPersonalization: {
enabled: true ,
context: {
userInterests: [ 'technology' , 'productivity' ],
purchaseHistory: [ 'laptop' , 'headphones' ]
}
},
templateId: 'tpl_recommendations'
});
A/B Test with AI
Let AI generate variants for testing:
const variants = await lettr . ai . generateVariants ({
baseContent: originalEmail ,
variantCount: 3 ,
focus: 'subject_line'
});
// Use variants in A/B test
const campaign = await lettr . campaigns . create ({
variants: variants ,
testSettings: {
winnerCriteria: 'open_rate'
}
});
Spam Score Analysis
Check if your email might trigger spam filters:
const analysis = await lettr . ai . analyzeSpam ({
html: emailHtml ,
subject: 'Limited Time Offer!'
});
// Returns:
{
score : 3.2 , // Lower is better
issues : [
{ type: 'subject' , message: 'Contains spam trigger word: "Limited"' },
{ type: 'content' , message: 'High image-to-text ratio' }
],
suggestions : [
'Consider rephrasing the subject line' ,
'Add more text content to balance images'
]
}
Usage Limits
Plan AI Requests/Month Free 100 Pro 5,000 Enterprise Unlimited
AI features use credits from your monthly allocation. Complex operations like full content generation use more credits than simple operations like subject line generation.