Send email notification with React Email template
Send email notifications using React Email templates with automatic HTML and plain text rendering.
**Features:**
- 🎨 **Professional Templates**: Pre-built React Email templates (OTP, Welcome, Invite)
- 📧 **Automatic Rendering**: Templates rendered to both HTML and plain text
- 👥 **Multiple Recipients**: Send to multiple email addresses
- 📊 **Tracking**: Optional delivery tracking by userId
- 🏷️ **Tagging**: Categorize emails with tags
- ⚡ **Priority**: Set delivery priority (high/normal)
**Available Templates:**
1. **OTP Template** (`templateType: "otp"`)
- Props: `{ otpCode, userName?, expiryMinutes?, companyName?, supportEmail? }`
- Use case: Authentication, verification codes
- Example OTP code display with security tips
2. **Welcome Template** (`templateType: "welcome"`)
- Props: `{ userName?, userEmail?, companyName?, dashboardUrl?, supportEmail? }`
- Use case: New user onboarding
- Includes getting started guide and dashboard link
3. **Invite Template** (`templateType: "invite"`)
- Props: `{ userName?, userEmail?, companyName?, inviteUrl?, supportEmail?, expiryHours?, phoneNumber? }`
- Use case: Early access / beta program invitations
- Includes onboarding steps, feature highlights, and TestFlight instructions
4. **Booking Confirmation Template** (`templateType: "booking-confirmation"`)
- Props: `{ userName?, bookingId?, experienceTitle?, experienceDate?, validUntil?, guests?, openTime?, purchasedBy?, location?, locationAddress?, partnerName?, partnerPhone?, partnerRefNumber?, viewTicketUrl?, getDirectionsUrl?, heroImageUrl?, companyName? }`
- Use case: Booking confirmation emails
- Includes reservation details, ticket info, and location
5. **Booking Cancellation Template** (`templateType: "booking-cancellation"`)
- Props: `{ userName?, bookingId?, experienceTitle?, cancellationDate?, refundMessage?, companyName?, supportEmail? }`
- Use case: Booking cancellation notifications
- Includes cancellation details and refund information
**Authentication:**
- Requires valid Bearer token
- Test tokens available for development: `test-jwt-token`, `agent-jwt-token`
**Example Request:**
```json
{
"recipients": ["user@example.com"],
"templateType": "otp",
"templateProps": {
"otpCode": "123456",
"userName": "John Doe",
"expiryMinutes": 10
},
"userId": "user-123",
"options": {
"priority": "high",
"tags": ["authentication", "login"],
"category": "general"
}
}
```
**Response Codes:**
- 200: Email sent successfully
- 400: Invalid request or email send failed
- 401: Authentication required or failed
**Best Practices:**
- Always provide `userId` for tracking
- Use `priority: "high"` for time-sensitive emails (OTP, verification)
- Add relevant tags for analytics and filtering
- Provide user context (userName, userEmail) for personalization
