Skip to content

Commit d120c9f

Browse files
authored
fix: Attachment examples (#160)
1 parent b895e9c commit d120c9f

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

with-attachments-content/src/pages/api/send.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const send = async (req: NextApiRequest, res: NextApiResponse) => {
1010
const { data } = await resend.emails.send({
1111
from: 'Acme <[email protected]>',
1212
13-
subject: 'Email with attachment',
14-
html: '<p>See attachment</p>',
13+
subject: 'Receipt for your payment',
14+
html: '<p>Thanks for the payment</p>',
1515
attachments: [
1616
{
1717
content,

with-attachments-content/src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const Index: React.FC = () => {
5151
type="file"
5252
name="file"
5353
onChange={onAddFileAction}
54-
accept="image/*"
54+
accept="image/*,.pdf"
5555
/>
5656
<input type="submit" value="Send Email" />
5757
</form>
-79 KB
Binary file not shown.

with-attachments/src/pages/api/send.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ const send = async (req: NextApiRequest, res: NextApiResponse) => {
77
switch (method) {
88
case 'GET': {
99
const data = await resend.emails.send({
10-
from: "Acme <[email protected]>",
11-
12-
subject: 'Receipt for Your Payment',
10+
from: 'Acme <[email protected]>',
11+
12+
subject: 'Receipt for your payment',
13+
html: '<p>Thanks for the payment</p>',
1314
attachments: [
1415
{
15-
path: 'path/to/file/invoice.pdf',
16-
filename: 'invoice.pdf',
16+
path: 'https://resend.com/docs/sample/invoice.pdf',
17+
filename: 'sample-invoice.pdf',
1718
},
1819
],
19-
html: '<h1>Thanks for the payment</h1>',
20-
text: 'Thanks for the payment',
2120
});
2221

2322
return res.status(200).send({ data: data.id });

0 commit comments

Comments
 (0)