# Resend quickstart ## Create a mailer ```ts import { ResendMailer } from '@workermailer/resend'; const mailer = await ResendMailer.connect({ apiKey: env.RESEND_API_KEY, from: env.RESEND_FROM }); ``` ## Send a message ```ts await mailer.send({ from: 'Acme Alerts ', to: 'alice@example.com', subject: 'Hello from Resend', text: 'This is a plain text message.', html: '

This is an HTML message.

' }); ``` If you omit `from` in the email payload, the mailer falls back to the `from` value passed in `ResendMailer.connect()`. ## One-off sends ```ts await ResendMailer.send( { apiKey: env.RESEND_API_KEY, from: env.RESEND_FROM }, { to: 'alice@example.com', subject: 'One-off send', text: 'Sent without keeping an instance open.', from: 'Acme Alerts ' } ); ``` ## Attachments Attachments use the same message field style as the SMTP package. ```ts await mailer.send({ from: 'Acme Alerts ', to: 'alice@example.com', subject: 'Invoice', text: 'Invoice attached.', attachments: [ { filename: 'invoice.pdf', content: pdfBase64, mimeType: 'application/pdf' } ] }); ```