Overview
PC Fix uses Resend to send:- Order Updates: Status changes, shipping notifications
- Customer Support: Contact confirmations, inquiry replies
- Authentication: Welcome emails, password resets
- Marketing: Abandoned cart reminders, stock alerts, price drops
Configuration
1
Create a Resend Account
Sign up for an account at resend.com. The free tier includes 100 emails per day.
2
Generate an API Key
Go to API Keys in your Resend dashboard and create a new API key with send permissions.
3
Verify Your Domain (Optional)
For production use, verify your sending domain in Resend to improve deliverability and remove “via resend.com” from emails.
4
Set Environment Variables
Add these variables to your
.env file in the packages/api directory:Email Service Implementation
TheEmailService class is located at packages/api/src/shared/services/EmailService.ts:
Available Email Templates
TheEmailService provides pre-built templates for common scenarios:
Order & Payment Emails
Authentication Emails
Customer Support
Marketing Emails
Email Template Structure
All email templates follow a consistent HTML structure:Email templates use inline CSS for maximum compatibility across email clients.
Usage Example
Here’s how to use the email service in your controllers:sales.controller.ts
Order Status Messages
ThesendStatusUpdate method automatically generates appropriate messages for each status:
Environment Variables
string
required
Your Resend API key from the dashboard
string
default:"PCFIX <noreply@pcfixbaru.com.ar>"
The sender email address and name
string
default:"pcfixbaru@gmail.com"
Reply-to email address for customer responses
string
Admin email for receiving notifications about new inquiries and receipts
string
default:"http://localhost:4321"
Frontend URL for generating links in emails
Testing Emails
Resend provides a test mode for development:Deliverability Tips
Verify Your Domain
Verify Your Domain
Add SPF, DKIM, and DMARC records to your domain to improve deliverability and remove “via resend.com” from emails.
Use Professional Sender Names
Use Professional Sender Names
Use a recognizable sender name like “PCFIX” rather than just an email address.
Include Unsubscribe Links
Include Unsubscribe Links
For marketing emails, always include an unsubscribe link to comply with regulations.
Monitor Bounce Rates
Monitor Bounce Rates
Check your Resend dashboard regularly for bounced emails and remove invalid addresses.
Error Handling
The email service includes error handling:Rate Limits
- Free Tier: 100 emails per day
- Paid Plans: Higher limits based on plan