The email capability sends transactional emails through reliable email infrastructure.
Providers
| Provider | Features |
|---|
| Resend | Modern API, high deliverability |
Basic Usage
const result = await saturn.email({
to: 'user@example.com',
subject: 'Welcome to our service',
text: 'Thanks for signing up!',
});
console.log(result.data.messageId);
// → Unique message ID for tracking
Parameters
to
string | string[]
required
Recipient email address(es).
HTML body (alternative to text).
Sender email address. Defaults to configured address.
Response
interface EmailResponse {
data: {
messageId: string; // Unique message ID
status: string; // 'sent', 'queued'
};
metadata: {
chargedUsdCents: number;
provider: string;
latencyMs: number;
auditId: string;
};
}
Examples
HTML Email
const result = await saturn.email({
to: 'user@example.com',
subject: 'Your weekly report',
html: `
<h1>Weekly Report</h1>
<p>Here's your summary for this week:</p>
<ul>
<li>Tasks completed: 15</li>
<li>Hours logged: 40</li>
</ul>
`,
});
Multiple Recipients
const result = await saturn.email({
to: ['alice@example.com', 'bob@example.com'],
subject: 'Team update',
text: 'Important team announcement...',
});
With AI-Generated Content
async function sendPersonalizedEmail(
to: string,
topic: string,
context: string
) {
// Generate email content with LLM
const content = await saturn.reason({
prompt: `Write a professional email about: ${topic}
Context: ${context}
Keep it concise and friendly.`,
});
// Send the email
return saturn.email({
to,
subject: `Update: ${topic}`,
text: content.data.content,
});
}
Pricing
| Provider | Cost |
|---|
| Resend | ~$0.001 per email |
Domain Configuration
To send from your own domain, you’ll need to configure DNS records (SPF, DKIM, DMARC). Contact support for custom domain setup.
By default, emails are sent from a Saturn-managed domain. For production use, configure your own sending domain for better deliverability.
Best Practices
- Always include a plain text version for accessibility
- Keep subjects under 50 characters
- Don’t send unsolicited emails (spam)
- Include unsubscribe options for marketing emails
- Test emails before sending to large lists