Closed thibautvdu closed 5 years ago
Update for future reference, that seems to be a limitation with the REST api itself, when using a templateId and the content parameter. Here is the error output using the REST api :
"code": "invalid_parameter",
"message": "Please don't pass attachment content & templateId in same request, instead use attachment url only"
That's quite inconvenient though as those are two very different things...
Hi @thibautvdu
We do not allow attachment generated on the fly (attachment.content
& attachment.name
) and templateId
together for now, but its a planned improvement for 2nd quarter of this year.
Currently, with templateId
attachment url (attachment.url
) is expected.
Attachment generated on the fly id expected with htmlContent
or textContent
Thanks
Hey,
As a workaround, you can use the method getSmtpTemplate of the SMTPApi to get template's description (replyTo, subject, sender, htmlContent, ...) and then use these informations to initialise an email and fill its attachment property wit Base64 encoding.
@fprevost Thanks for the workaround !
@fprevost Thanks for the workaround !
Can you please help me how you it solved
Hello everyone,
The present documentation for SendSmtpEmailAttachment (used in SendTransacEmail) says the 'content' variable should be set to a 'Blob'. There is no such type in Node.js, so I assumed it was a base64 string, but the api answer with a Bad request error (working fine if I use url instead of content). Related code :
pdfBuffer is a buffer object. Did anyone successfully send content on the fly with this API ? Any help would be welcomed !