小编tcc*_*est的帖子

通过UWP EmailManager发送电子邮件附件无法正常工作

使用以下代码从通用应用程序发送附件不起作用,为什么?

        Dim emailMessage As New EmailMessage()
        emailMessage.[To].Add(New EmailRecipient("a@b.com"))
        emailMessage.Subject = "Test"
        emailMessage.Body = "Hello World"

        Dim localAppFolder = Windows.Storage.ApplicationData.Current.LocalFolder
        Dim file = Await localAppFolder.CreateFileAsync("SomeFile.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting)
        Await Windows.Storage.FileIO.WriteTextAsync(file, "aaaa")
        Dim fileRef = RandomAccessStreamReference.CreateFromFile(file)
        emailMessage.Attachments.Add(New EmailAttachment(file.Name, fileRef))
        Await EmailManager.ShowComposeNewEmailAsync(emailMessage)
Run Code Online (Sandbox Code Playgroud)

To,subject和body在Outlook中显示正常,但附件丢失:Outlook截图

email-attachments uwp

13
推荐指数
1
解决办法
2157
查看次数

标签 统计

email-attachments ×1

uwp ×1