send_email
Send emails through SMTP, API services, or webhooks like Slack and Discord. Supports HTML bodies, CC, and BCC for flexible communication.
Instructions
Send an email via specified email service.
Sends an email using the specified email service. Supports SMTP, API-based services, local testing services, and webhook integrations. Automatically detects service capabilities and uses the appropriate sending method.
Args: to: Recipient email address(es). Can be: - Single address: "user@example.com" - Comma-separated: "user1@example.com, user2@example.com" - List: ["user1@example.com", "user2@example.com"] subject: Email subject line. Required. body: Plain text email body. Required. This serves as the fallback for email clients that don't support HTML. service: Email service to use. Options: - "default": Default SMTP/IMAP service (from env vars) - "sendgrid": SendGrid transactional email - "mailgun": Mailgun transactional email - "resend": Resend transactional email - "mailhog": Local MailHog testing service - "slack": Send to Slack webhook - "discord": Send to Discord webhook - Custom service names configured via EMAIL_SERVICES html: Optional HTML email body. If provided, the email will be sent as multipart/alternative with both text and HTML versions. Example: "TitleContent" cc: Optional CC (carbon copy) recipients. Same format as 'to'. bcc: Optional BCC (blind carbon copy) recipients. Same format as 'to'.
Returns: Dictionary with service-specific results: { "success": bool, # True if email sent successfully "status": str, # "sent" on success "service": str, # Service used "to": str, # Recipient address(es) "subject": str, # Email subject "error": str # Error message if success is False }
Examples: # Send via default SMTP service send_email( to="user@example.com", subject="Hello", body="This is a test email" )
# Send via SendGrid
send_email(
to="user@example.com",
subject="Welcome",
body="Welcome to our service",
service="sendgrid",
html="<h1>Welcome!</h1><p>Thanks for joining.</p>"
)
# Send to Slack webhook
send_email(
to="general",
subject="Alert",
body="System alert message",
service="slack"
)Notes: - Service availability depends on configuration - API services may have different rate limits and features - Local testing services don't send real emails - Webhook services convert emails to chat messages
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| subject | Yes | ||
| body | Yes | ||
| service | No | default | |
| html | No | ||
| cc | No | ||
| bcc | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||