使用逻辑应用程序发送带有 pdf 附件的电子邮件:PDF 未打开它被损坏了

问题描述

enter image description here

使用 json 对象以 Base64 字符串发送 PDF。在传递之前将 Stream 转换为 Base64。使用 Http trigger post 调用逻辑应用

enter image description here

电子邮件是使用来自逻辑应用程序的 pdf 生成的,但未打开 PDF。 Base64 内容是否已损坏?

在逻辑应用中,通过 ContentBytes => triggerBody()['attachments']?['ContentBytes'] 和 ContentBytes => base64(triggerBody()['attachments']?['ContentBytes'])

enter image description here

解决方法

经过一些测试后,您应该使用 base64ToBinary 表达式:

base64ToBinary(triggerBody()['attachments']?['ContentBytes'])