Skip to content

Commit

Permalink
chore(docs): update SES to v2 API
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunyel authored Oct 14, 2024
1 parent 4f8d061 commit a3ddd75
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions docs/email-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,35 @@ While JSX email can be used with just about any email provider that takes a stri

```tsx
import { render } from 'jsx-email';
import { SES } from '@aws-sdk/client-ses';
import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-ses';

import { BatmanTemplate } from './emails/Batman.tsx';

const ses = new SES({ region: process.env.AWS_SES_REGION });
const html = render(<BatmanTemplate firstName="Bruce" lastName="Wayne" />);
const ses = new SESv2Client({ region: process.env.AWS_SES_REGION });
const html = await render(<BatmanTemplate firstName="Bruce" lastName="Wayne" />);

await ses.sendEmail({
Source: 'penguin@joker.us',
Destination: {
ToAddresses: ['bruce@wayneinc.com']
},
Message: {
Body: {
Html: {
Charset: 'UTF-8',
Data: html
}
await ses.send(
new SendEmailCommand({
FromEmailAddress: 'penguin@joker.us',
Destination: {
ToAddresses: ['bruce@wayneinc.com']
},
Subject: {
Charset: 'UTF-8',
Data: 'Did you get that thing I sent you?'
Content: {
Simple: {
Body: {
Html: {
Charset: 'UTF-8',
Data: html
}
},
Subject: {
Charset: 'UTF-8',
Data: 'Did you get that thing I sent you?'
}
}
}
}
});
})
);
```

## Mailersend
Expand Down

0 comments on commit a3ddd75

Please sign in to comment.