我想在脚本下面发送一封电子邮件给莲花笔记,但我发现在莲花笔记中,正文消息的字体大小稍微大一点,所以我想把它的字体大小改成一个小的,但是应该到期在下面的函数字符串体是一个变量,我不知道如何改变它的字体大小,所以这里的任何人都可以帮助我吗?提前谢谢
Public Shared Sub SendMail(ByVal from As String, ByVal towhere As String, ByVal subject As String, ByVal body As String)
Dim mailservername As String
mailservername = "POSTMASTER@mailserver.com"
Dim Message As New System.Net.Mail.MailMessage(from, towhere, subject, body)
Dim mailClient As New System.Net.Mail.SmtpClient()
mailClient.Host = mailservername
mailClient.UseDefaultCredentials = True
mailClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
mailClient.Send(Message)
End Sub
the body message is such as body = str1 + " " + str2 + " " + str3
str1 and str2 are constant strings, but str3 are variable, what I want to change is str3's font size
答案 0 :(得分:1)
邮件正文可以采用不同的格式。你上面使用的是痛苦文本格式(内容类型是text / plain)。您可以使用html格式(text / html)和(或代替)文本格式,然后在html中,您可以使用CSS样式或html标签丰富地设置邮件样式。请参阅此article,了解如何发送HTML邮件。
编辑:编辑放置代码片段(在评论中,它变得凌乱)
body = "<span style=""font-size:10pt;"">" + str1 + " " + str2 + "</span><span style=""font-size:12pt;"">" + str3 + "</span>"
mailClient.Body = body
mailClient.IsBodyHtml = True