const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.SENDGRID_API_KEY}`,
},
body: JSON.stringify({
personalizations: [{ to: [{ email: options.to }], subject: options.subject }],
from: { email: 'from-email' },
reply_to: { email: 'to-email' },
content: [
{
type: 'text/plain',
value: 'YOUR_EMAIL_TEXT',
},
{
type: 'text/html',
value: 'YOUR_EMAIL_HTML',
},
],
mail_settings: { sandbox_mode: false // as-needed } },
}),
});
const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.SENDGRID_API_KEY}`,
},
body: JSON.stringify({
personalizations: [{ to: [{ email: options.to }], subject: options.subject }],
from: { email: 'from-email' },
reply_to: { email: 'to-email' },
content: [
{
type: 'text/plain',
value: 'YOUR_EMAIL_TEXT',
},
{
type: 'text/html',
value: 'YOUR_EMAIL_HTML',
},
],
mail_settings: { sandbox_mode: false // as-needed } },
}),
});