resend/resend-examples

Sending ICS files

Closed this issue · 2 comments

I'm facing issues sending ics files via resend api. The email contains the file but it is not possible to open it, for me it looks like that the file included in the email is in bytes.

when using the following query

  "from": "noreply <noreply@sender.com>",
  "to": [
    "myEmailAddress@gmail.com"
  ],
  "subject": "hello world",
  "text": "it works! with ics",
  "headers": {
    "X-Entity-Ref-ID": "123"
  },
  "attachments": [
    {
      "filename": "meeting.ics",
      "content": "
        BEGIN:VCALENDAR\n
        VERSION:2.0\n
        BEGIN:VEVENT\n
        SUMMARY:MyMeeting\n
        DESCRIPTION:Github\n
        LOCATION:\n
        DTSTART:20230907T130736Z\n
        DTEND:20230907T132236Z\n
        ORGANIZER;CN=Erik:mailto:myEmailAddress@gmail.com\n
        ATTENDEE;CN=Erik;ROLE=REQ-PARTICIPANT:mailto:myEmailAddress@gmail.com\n
        BEGIN:VALARM\n
        TRIGGER:-PT15M\n
        ACTION:DISPLAY\n
        DESCRIPTION:Reminder\n
        END:VALARM\n
        END:VEVENT\n
        END:VCALENDAR\n"
    }
  ]
}

@bukinoshita is there a possibility for support here?

Hey @erik-metz, we just added an example for ICS files:

const data = await resend.sendEmail({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: '30 Minute Meeting',
  attachments: [
    {
      path: 'https://gist.githubusercontent.com/zenorocha/4317a548e4cca166d0f50d54733f3f03/raw/37edb0735ab07e663b794d348dd99d7e6c9575be/invite.ics',
      filename: 'invite.ics',
    },
  ],
  headers: {
    'Content-Disposition': 'attachment; filename="invite.ics"',
    'Content-Type': 'text/calendar',
  },
  html: '<h1>Thanks for the invite</h1>',
});

You can see the entire code here: #66