首页 > 解决方案 > 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 中插入有用的数据。

标签: c#html

解决方案


推荐阅读