c# - HTML 附加字符串
问题描述
我正在尝试创建一个向用户发送邮件的功能。我正在使用 MailMessage 并发送一个 htmlbody 回来,在 html 正文中我想插入一些动态创建的数据。我的 html 保存在一个字符串中,
public static string HtmlBody = @"<html><body><p>Following mail contains the test results for the following test id {0}</p></body></html>";
因为我使用的是@,所以我不能使用 string.format。我的功能有效,这意味着 html 是有效的,我可以发送电子邮件,但我无法在 html 中插入有用的数据。
解决方案
推荐阅读
- flutter - setState() 在更新 UI 方面是否有任何限制
- react-native - AsyncStorage getItem 和 setItem 在 Android 设备中不起作用
- java - Spring Boot Mongo DB .yml 配置
- javascript - 如何使用 javascript 将 div 重置为其原始样式
- mysql - 当column2 =“Y”时,如何计算column1中使用值X的次数?
- java - RxJava - Observable 的压缩列表如果抛出异常如何获得成功响应
- c - 如何打破数学运算符的长线?
- javascript - 如果更改订单包含三元运算符,为什么逻辑或工作方式不同
- git - 如何使用 LibGit2Sharp 控制行尾转换?
- kubernetes-helm - 人类可读日期时间的模板?