So in V2 application when we were replying to an email message, we were appending RE: before the subject so that we have the same behaviour as in the other email applications.
But now when i’m testing the v3 app and trying to reply to a message. it gives me the following error:
“subject does not match subject of message you are replying to”
the message to which i’m replying to has subject:
“Reply to Email Test”
When i’m replying to that email with subject
subject: ‘re: Reply to Email Test’
It gives me error.
Why the behaviour is different from v2 app in v3? and why it is different from normal email providers like gmail, outlook, yahoo
What can i do to fix this?
Using the following code of nodejs sdk:
export const sendEmailWithAttachments = async ({
grantId,
from,
fromName,
to,
subject,
text,
replyToMessageId,
files= [],
cc= [],
}: SendEmailParams) => {
console.log(`SendEmail with reply to: ${replyToMessageId}, subject: ${subject}`)
const filesToUpload=Array.isArray(files) ?files: [files]
const attachments:CreateAttachmentRequest[] = []
for (constfileoffilesToUpload) {
const base64=file.data.split("base64,")?.[1] ??""
const buffer=Buffer.from(base64, "base64")
const readableStream=newReadable({
read() {
this.push(buffer)
this.push(null) // End the stream
},
})
attachments.push({
content:readableStream,
filename:file.filename,
contentType:getContentType(file.filename),
size:file.size,
})
}
const message:SendMessageRequest= {
subject,
body:text,
to: [{ email:to }],
cc:cc.map((email) => ({ email })),
from: [{ email:from, name:fromName }],
...(replyToMessageId&& { replyToMessageId:replyToMessageId }),
trackingOptions: {
threadReplies:true,
opens:true,
},
attachments,
}
const sentMessage=awaitnylas.messages.send({
identifier:grantId,
requestBody:message,
})
return sentMessage.data
}