- IMAP credentials (host, port, username, password)
- SMTP credentials (host, port, username, password)
- From address for sending emails
Step 1: Gather Email Credentials
You’ll need IMAP and SMTP settings from your email provider. Here are common configurations:Gmail
Gmail
IMAP:
- Host:
imap.gmail.com - Port:
993 - Use TLS:
true
- Host:
smtp.gmail.com - Port:
587 - Use STARTTLS:
true
Outlook / Office 365
Outlook / Office 365
IMAP:
- Host:
outlook.office365.com - Port:
993 - Use TLS:
true
- Host:
smtp.office365.com - Port:
587 - Use STARTTLS:
true
Fastmail
Fastmail
IMAP:
- Host:
imap.fastmail.com - Port:
993 - Use TLS:
true
- Host:
smtp.fastmail.com - Port:
587 - Use STARTTLS:
true
Step 2: Add Credentials to Spacebot
- TOML Config
config.toml
config.toml
Step 3: Configure Polling
By default, Spacebot polls the INBOX folder every 60 seconds. You can customize this:config.toml
The minimum poll interval is 5 seconds. Lower values may trigger rate limits from your email provider.
Step 4: Test the Connection
Send an email to your configured address. Spacebot should:- Poll the inbox within the configured interval
- Process the email and send a reply
Sender Filtering
By default, Spacebot processes emails from any sender. To restrict to specific senders:config.toml
Threading
Spacebot detects email threads usingIn-Reply-To and References headers. Replies in the same thread map to the same conversation.
Each thread gets a unique conversation ID based on:
- The first
Message-IDin theReferenceschain, or - The
In-Reply-Toheader, or - A hash of the subject + sender
Attachments
Spacebot supports sending and receiving file attachments:- Receiving: Attachments are listed in
MessageContent::Mediawith filenames - Sending: Use
OutboundResponse::Fileto attach files to replies
config.toml
Auto-Generated Email Filtering
Spacebot automatically ignores auto-generated emails:- Bounce messages (
Auto-Submitted: auto-replied) - Out-of-office replies (
Precedence: auto_reply) - Mailing list digests (
Precedence: bulk) - System notifications (
X-Autoreplyheader present)
HTML Emails
Spacebot automatically converts HTML emails to plain text:- HTML tags are stripped
- Common entities (
,&, etc.) are decoded - Whitespace is normalized
Multiple Folders
Poll multiple IMAP folders simultaneously:config.toml
Limitations
- No streaming — Email doesn’t support real-time streaming; responses are sent as complete messages.
- Polling delay — Responses arrive after the next poll cycle (default 60 seconds).
- No reactions — Email doesn’t support emoji reactions or status indicators.
- No history backfill — Only new unseen emails are processed; existing emails are not backfilled.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Authentication failed | Wrong credentials | Verify username and password; check if app password is required |
TLS handshake failed | Wrong TLS setting | Gmail/Outlook use imap_use_tls = true for IMAP and smtp_use_starttls = true for SMTP |
| Bot doesn’t see new emails | Poll interval too long | Reduce poll_interval_secs or manually trigger a poll |
| Emails not marked as seen | IMAP permissions | Ensure the account has write permissions on the mailbox |
| Replies not sending | SMTP auth failed | Verify SMTP credentials; check if 2FA app password is required |
| Attachment upload fails | Size limit exceeded | Reduce file size or increase max_attachment_bytes |
| Auto-reply loop | Auto-generated filter disabled | Enable auto-generated filtering (enabled by default) |
Advanced Configuration
Multiple Email Accounts
Run multiple email instances with different credentials:config.toml
Custom Headers
All emails sent by Spacebot include proper threading headers:In-Reply-To: References the message being replied toReferences: Full chain of message IDs in the threadMessage-ID: Generated for each sent email
Next Steps
Configure Filters
Restrict who can send emails to the bot
Threading
Understand how email threads work
Agent Configuration
Route different email addresses to different agents