Send invoice via email
Sends an invoice to a customer via email. This endpoint is planned for future implementation.Body parameters
The unique identifier of the invoice to send
The email address of the recipient. Must be a valid email format.
Custom email subject line. Defaults to “Your Invoice”
Optional custom message to include in the email body
Response
Information about the endpoint status
The invoice ID that was requested to be sent
The recipient email address
The email subject line used
Implementation steps for developers
501 - Not implemented
Errors
400 - Missing required fields
400 - Invalid email address
500 - Internal server error
Email validation
The endpoint validates email addresses using a regular expression pattern:/^[^\s@]+@[^\s@]+\.[^\s@]+$/
This ensures the recipient email:
- Contains an @ symbol
- Has characters before and after the @
- Contains a domain with a period
- Does not contain whitespace
Implementation notes
This endpoint is currently not implemented and returns a501 Not Implemented status. The following email services are recommended for implementation:
- Resend - Modern email API with great developer experience
- SendGrid - Enterprise email delivery service
- Mailgun - Email automation platform
- AWS SES - Amazon Simple Email Service
- Retrieve the invoice data from your database
- Generate a PDF version of the invoice (or create an HTML email template)
- Send the email using your chosen service with the invoice attached or linked
- Update the invoice status to “sent”
- Return a success response
app/api/email/route.ts:14-69 for the current implementation and validation logic.