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

Cannot send attachment using Resend #101

Open
trulysinclair opened this issue Jul 24, 2024 · 4 comments
Open

Cannot send attachment using Resend #101

trulysinclair opened this issue Jul 24, 2024 · 4 comments

Comments

@trulysinclair
Copy link

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

@CodingDive
Copy link

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
 })

@CodingDive
Copy link

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 resend/resend-node#319

@thetutlage
Copy link
Member

@CodingDive Thanks for narrowing down the issue. So we just have to wait for Resend to allow this?

@trulysinclair
Copy link
Author

@CodingDive Thank you for the embedData tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants