Email Send
Scanned@Xejrax
npx machina-cli add skill @Xejrax/email-send --openclawEmail Send Skill
Send a quick email via SMTP without opening the full himalaya client. Requires SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS env vars.
Sending Email
Send a basic email:
echo "Meeting at 3pm tomorrow." | msmtp recipient@example.com
Send with subject and headers:
printf "To: recipient@example.com\nSubject: Quick update\n\nHey, the deploy is done." | msmtp recipient@example.com
Options
--cc-- carbon copy recipients--bcc-- blind carbon copy recipients--attach <file>-- attach a file
Install
sudo dnf install msmtp
Overview
This skill sends a basic email directly through an SMTP server using msmtp, without opening a full mail client. It requires SMTP_HOST, SMTP_PORT, SMTP_USER, and SMTP_PASS environment variables and is ideal for scripting and automation.
How This Skill Works
msmtp delivers messages by reading the message data from stdin or headers you provide and authenticating to your SMTP server using the configured environment variables. You can pipe a simple message or include headers like To and Subject, and extend functionality with --cc, --bcc, and --attach for copies and attachments.
When to Use It
- Automating quick Notifications from scripts without a GUI mail client
- Sending a test email to verify SMTP configuration during setup
- Delivering deployment or build status updates in CI/CD pipelines
- Sending emails to multiple recipients with CC or BCC
- Attaching files to messages for lightweight file transfers via email
Quick Start
- Step 1: Install msmtp (dnf) - sudo dnf install msmtp
- Step 2: Configure environment variables - export SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS
- Step 3: Send a message by piping content to msmtp, e.g. echo "Hi" | msmtp recipient@example.com
Best Practices
- Store SMTP credentials in environment variables or a secrets manager and avoid hard-coding
- Set a proper From address and verify SPF/DKIM as needed for deliverability
- Use --cc and --bcc to manage recipients without exposing them in the To header
- Utilize --attach for sending files; ensure attachment sizes comply with server limits
- Test SMTP settings with a simple message before automating in scripts
Example Use Cases
- echo "Meeting at 3pm tomorrow." | msmtp recipient@example.com
- printf "To: recipient@example.com\nSubject: Quick update\n\nHey, the deploy is done." | msmtp recipient@example.com
- msmtp --cc manager@example.com --bcc auditor@example.org recipient@example.com < message.txt
- printf "To: team@example.com\nSubject: Build complete\n\nAll tests passed." | msmtp --attach build.log recipient@example.com
- export SMTP_HOST=smtp.example.com; export SMTP_PORT=587; export SMTP_USER=user; export SMTP_PASS=pass; echo "Status: OK" | msmtp admins@example.com