admin管理员组文章数量:1391955
I'm new to SendGrid and using the SendGrid APIV3 (Go language package) to send an email with multiple attachments, including different file types like CSV, JPG, ZIP, TXT, PNG, and PPT. I need to send these attachments in a specific order, which is the order in which I add them to the message.
for idx, att := range attachments {
attachment := sendgrid.NewAttachment()
encodedFile := base64.StdEncoding.EncodeToString(att.FileData)
attachment.SetType(att.MIMEType)
attachment.SetFilename(att.FileName)
attachment.SetContent(encodedFile)
message.AddAttachment(attachment)
}
Is there a way to control the order of attachments when sending an email via SendGrid? Does SendGrid follow any default order when attaching files
Any guidance or examples would be appreciated!
I'm new to SendGrid and using the SendGrid APIV3 (Go language package) to send an email with multiple attachments, including different file types like CSV, JPG, ZIP, TXT, PNG, and PPT. I need to send these attachments in a specific order, which is the order in which I add them to the message.
for idx, att := range attachments {
attachment := sendgrid.NewAttachment()
encodedFile := base64.StdEncoding.EncodeToString(att.FileData)
attachment.SetType(att.MIMEType)
attachment.SetFilename(att.FileName)
attachment.SetContent(encodedFile)
message.AddAttachment(attachment)
}
Is there a way to control the order of attachments when sending an email via SendGrid? Does SendGrid follow any default order when attaching files
Any guidance or examples would be appreciated!
Share Improve this question asked Mar 12 at 15:44 ManoMano 111 bronze badge1 Answer
Reset to default 0There is no manner in which SendGrid's API can place attachments in a specific order, and even if it were possible, each email client may still change how those attachments appear to the end user. In other words, even if you could set the order, Gmail may still show them in a different order, and then Microsoft Outlook may show them in a different order yet.
Your best bet is to try to take advantage of the most likely method of sorting attachments that any email client would use; alphanumerically. To that end, I would recommend renaming the files you attach to have a numerical prefix.
1 - mycarets.csv
2 - adobe.pdf
3 - picturethis.png
That will likely get the files in the order you'd prefer the most often.
本文标签: twilioHow to Send Attachments in a Specific Order Using SendGrid APIStack Overflow
版权声明:本文标题:twilio - How to Send Attachments in a Specific Order Using SendGrid API? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744743291a2622737.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论