【发布时间】:2015-06-27 05:40:04
【问题描述】:
我正在使用 SmtpClient 对象将 MailMessage 从一个 MailAddress 发送到另一个。我正在尝试使用等宽字体将 MailMessage 的正文格式化为居中,但连续的空格总是被单个空格替换。
所以:
With smtpMessage
.IsBodyHtml = True
.Body = "<body style=""font-family:monospace"">"
.Body &= " ************************************************************<br>"
.Body &= " * This email was generated by an automated system. *<br>"
.Body &= " * Please do not reply to this email. *<br>"
.Body &= " ************************************************************<br>"
.Body &= "</body>"
End With
被接收为:
************************************************************
* This email was generated by an automated system. *
* Please do not reply to this email. *
************************************************************
我已经四处搜索,但我发现的只是关于换行符无法正确显示的主题,而不是关于空格本身的主题。
【问题讨论】:
-
尝试用
&nbsp;替换空格 -
Text-align: center ...将其添加到您设置样式的body标签中......
标签: vb.net whitespace smtpclient mailmessage