mail
mail copied to clipboard
Cannot send attachment using Resend
Package version
6.12.1
Describe the bug
When sending an email using a class email, everything works until trying to follow the attaching files process. All I get is failures, and upon looking at the error I get "Unable to send email using the resend transport: Response code 422 (Unprocessable Entity)".
export default class ChangelogNotification extends BaseMail {
subject = 'Tailwind test'
/**
* The "prepare" method is called automatically when
* the email is sent or queued.
*/
prepare() {
this.message.to('********@*****.net')
this.message.html(ChangelogEmail({ text: 'Trust reputation' }))
this.message.attach(app.makePath('public/deepslate.png'), {})
}
}
Reproduction repo
No response
Same thing happened to me with attach.
embedData fixed the 422 issue and I was able to send my attachment.
const myAttachmentPath = app.publicPath("attachment.png");
const fileBuffer= await fs.readFile(myAttachmentPath );
this.message
.to(this.props.email)
.html(html)
.text(text)
.embedData(fileBuffer, 'fileName', {
// encoding: "base64",
// contentType
// fileName
})
For those who stumble upon this issue, trying to make a cid attachment, it does not seem to be supported in resend in this moment https://github.com/resend/resend-node/issues/319
@CodingDive Thanks for narrowing down the issue. So we just have to wait for Resend to allow this?
@CodingDive Thank you for the embedData tip!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing as the limitation is on the Resend side