gpt4 book ai didi

c# - 隐藏通过电子邮件发送的附件中的文件路径 C#

转载 作者:行者123 更新时间:2023-11-30 23:08:10 25 4
gpt4 key购买 nike

代码如下:

message.Attachments.Add(new Attachment("C:/Program Files (x86)/Software/Extraction/INVOICE_AMOUNT_VS_ORDER_AMOUNT.xlsx"));

在发送的邮件中显示为“/Program Files (x86)/Software/Extraction/INVOICE_AMOUNT_VS_ORDER_AMOUNT.xlsx”。

我只需要接收者看到文件名。

最佳答案

发生这种情况是因为您使用了错误的斜杠(路径分隔符)。

改变这个:

message.Attachments.Add(new Attachment("C:/Program Files (x86)/Software/Extraction/INVOICE_AMOUNT_VS_ORDER_AMOUNT.xlsx"));

对此:

message.Attachments.Add(new Attachment(@"C:\Program Files (x86)\Software\Extraction\INVOICE_AMOUNT_VS_ORDER_AMOUNT.xlsx"));

关于c# - 隐藏通过电子邮件发送的附件中的文件路径 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46711531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com