email-smtp-send
Email SMTP Send
Core Goal
- Send outbound email via SMTP with env-configured credentials.
- Attach local files into MIME email payload when requested.
- Optionally append the sent message to IMAP sent mailbox for cross-client visibility.
- Validate SMTP and sent-sync configuration before delivery.
- Return machine-readable JSON status/error output.
Workflow
- Configure SMTP env vars (see
references/env.mdandassets/config.example.env). - Optional: configure IMAP sent-sync env vars and install
imapclientwhen sync is enabled. - Validate configuration:
python3 scripts/smtp_send.py check-config
- Send one email:
python3 scripts/smtp_send.py send \
--to recipient@example.com \
--subject "SMTP test" \
--body "Hello from email-smtp-send"
- Send with attachments:
python3 scripts/smtp_send.py send \
--to recipient@example.com \
--subject "Package delivery" \
--body "See attachments." \
--attach ./report.pdf \
--attach ./appendix.xlsx
- Send and sync to sent mailbox:
python3 scripts/smtp_send.py send \
--to recipient@example.com \
--subject "Synced send" \
--body "This message will be appended to Sent Items." \
--sync-sent \
--sent-mailbox "Sent Items"
Output Contract
check-configprints sanitized SMTP config + defaults + sent-sync config JSON.sendsuccess prints onetype=statusJSON object containing:event=smtp_sent- sender, recipient summary, subject, SMTP host/port
message_idattachment_countandattachments[]metadatasent_syncobject withenabled,required,appended, and sync metadata/error
sendfailures printtype=errorJSON to stderr with one of:event=smtp_send_invalid_argsevent=smtp_send_failedevent=smtp_sent_sync_failed(only when sync is required and sync fails)
Parameters
send --to: required recipient, repeatable or comma-separated.send --cc: optional CC recipients.send --bcc: optional BCC recipients.send --subject: optional subject (defaults from env).send --body: optional body (defaults from env).send --content-type:plainorhtml.send --from: optional sender override.send --attach: optional local attachment path, repeatable or comma-separated.send --max-attachment-bytes: max bytes allowed per attachment.send --message-id: optional Message-ID header.send --in-reply-to: optional In-Reply-To header.send --references: optional References header.send --sync-sent|--no-sync-sent: force-enable/disable IMAP sent sync for this send.send --sent-mailbox: override sent mailbox.send --sent-flags: IMAP APPEND flags, comma-separated (default\Seen).send --sent-sync-required: return non-zero if SMTP succeeds but sent sync fails.
Environment defaults:
SMTP_HOST,SMTP_PORT,SMTP_SSL,SMTP_STARTTLSSMTP_USERNAME,SMTP_PASSWORD,SMTP_FROM,SMTP_CONNECT_TIMEOUTSMTP_SUBJECT,SMTP_BODY,SMTP_CONTENT_TYPESMTP_MAX_ATTACHMENT_BYTESSMTP_SYNC_SENT,SMTP_SYNC_SENT_REQUIREDSMTP_SENT_IMAP_HOST,SMTP_SENT_IMAP_PORT,SMTP_SENT_IMAP_SSLSMTP_SENT_IMAP_USERNAME,SMTP_SENT_IMAP_PASSWORDSMTP_SENT_IMAP_MAILBOX,SMTP_SENT_IMAP_FLAGS,SMTP_SENT_IMAP_CONNECT_TIMEOUT- compatibility fallbacks:
IMAP_HOST,IMAP_PORT,IMAP_SSL,IMAP_USERNAME,IMAP_PASSWORD,IMAP_CONNECT_TIMEOUT
Dependency
- Sent-sync mode requires
imapclient:
python3 -m pip install imapclient
Error Handling
- Invalid env config exits with code
2. - Send failure exits with code
1. - If sync is required (
--sent-sync-requiredorSMTP_SYNC_SENT_REQUIRED=true), sync failure exits with code1.
References
references/env.md
Assets
assets/config.example.env
Scripts
scripts/smtp_send.py
More from fadeloo/skills
email-imap-fetch
Listen for one or more IMAP inboxes with the IDLE command, fetch unread email metadata plus text previews, and forward each message to OpenClaw webhooks. Use when tasks need near-real-time mailbox monitoring, multi-account inbox ingestion via environment variables, and automatic trigger delivery into OpenClaw automation.
8ai-tech-fulltext-fetch
Fetch and persist article full text for RSS entries already stored in SQLite by ai-tech-rss-fetch. Use when backfilling or incrementally syncing body text from entries.url or entries.canonical_url into a companion table for downstream indexing, retrieval, or summarization.
8ai-tech-summary
Retrieve time-windowed RSS evidence from SQLite and let the agent produce final summaries using RAG over selected records and fields. Use when generating daily, weekly, monthly, or custom-range AI tech digests directly in agent responses instead of fixed template reports.
7ai-tech-rss-fetch
Subscribe to AI and tech RSS feeds and persist normalized metadata into SQLite using mature Python tooling (feedparser + sqlite3). Use when adding feed URLs/OPML sources, running incremental sync with deduplication, and storing entry metadata without full-text extraction or summarization.
7sustainability-rss-fetch
Ingest all sustainability journal RSS entries into a dedicated RSS SQLite database first, keyed by DOI, then mark relevance and prune non-relevant rows to DOI-only. Use when building a DOI-first ingestion pipeline with mandatory full ingestion before topic filtering.
7sustainability-summary
Retrieve time-windowed relevant sustainability RSS evidence from the RSS metadata SQLite database and optionally join DOI-keyed enriched content from a separate fulltext SQLite database. Use when generating grounded daily, weekly, monthly, or custom-range digests after relevance labeling.
7