Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the respond object in the usage examples #471

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,31 @@ const resend = new Resend('re_123456789');
Send your first email:

```js
await resend.emails.send({
const { data } = await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
text: 'it works!',
});

console.log(`Email ${data.id} has been sent`);
```

## Send email using HTML

Send an email custom HTML content:

```js
await resend.emails.send({
const { data } = await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
html: '<strong>it works!</strong>',
});

console.log(`Emaill ${data.id} with customer HTML content has been sent.`);
```

## Send email using React
Expand All @@ -78,13 +82,15 @@ Then import the template component and pass it to the `react` property.
```jsx
import EmailTemplate from '../components/EmailTemplate';

await resend.emails.send({
const { data } = await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
react: <EmailTemplate firstName="John" product="MyApp" />,
});

console.log(`Email ${data.id} with a React template has been sent`);
```

## License
Expand Down