Shiply integrates with SendGrid for managing outbound emails. Configure it in the /.env
.
This guide will walk you through setting up SendGrid to handle all your email needs efficiently. 🚀
Below is a simple example of how to send an email using the @sendmail.ts
utility:
1 // Example usage of sendEmail from @sendmail.ts
2 import { sendEmail } from '@/lib/emailProvider/sendmail';
3
4 sendEmail({
5 to: 'recipient@example.com',
6 subject: 'Hello from Shiply!',
7 text: 'This is a plain text email sent using SendGrid.',
8 html: '<strong>This is a HTML email sent using SendGrid.</strong>',
9 replyTo: 'your-email@example.com'
10 }).then(() => {
11 console.log('Email successfully sent');
12 }).catch((error) => {
13 console.error('Failed to send email:', error);
14 });
.env
file:1 SENDGRID_API_KEY=YOUR_SENDGRID_API_KEY_HERE