sendAgentEmail()
Sends an email via the PhoneClaw agent email service. Useful for notifications, alerts, and automation reports.string
required
Recipient email address.
string
required
Email subject line.
string
required
Email body content. Supports plain text only.
void
Sends email asynchronously. Success/failure is spoken via TTS.
Basic Usage
Practical Examples
Implementation Details
Source Location
MainActivity.kt:738
Email Service
The function sends emails through a backend API:- HTTP POST to configured server endpoint
- Requires security key authentication
- 30-second timeout for requests
- Asynchronous execution (non-blocking)
Email delivery is asynchronous. The function returns immediately while the email is sent in the background.
Configuration
To configure the email service:- Set up a backend email API endpoint
- Update
apiUrlinMainActivity.kt:742 - Update
securityKeyinMainActivity.kt:741 - Rebuild the app
Backend API Format
Your email endpoint should accept:Complete Examples
Automation Report System
Multi-Recipient Notifications
Scheduled Reports
Best Practices
Use descriptive subject lines
Use descriptive subject lines
Include context in subjects for easy filtering and prioritization.
Include timestamps and context
Include timestamps and context
Always include when and where events occurred.
Avoid email spam
Avoid email spam
Rate-limit notifications to prevent flooding inboxes.
Use for critical events only
Use for critical events only
Reserve emails for important events. Use speech or logs for routine updates.
Limitations
Troubleshooting
Email Not Sending
Check these common issues:- Backend not configured: Verify
apiUrlpoints to valid endpoint - Security key mismatch: Ensure key matches backend
- Network issues: Check device internet connection
- Backend errors: Check backend logs
Testing
Related Functions
- speakText() - Alternative notification method via TTS
- schedule() - Schedule automated email reports
- delay() - Add delays between multiple emails