ASP 经典 CDO 电子邮件消息传递 - 如何隐藏电子邮件消息中的空格和换行符
如何转换电子邮件中的空格和制表符。请参阅下面的示例。
test1
test
zzzyyy trsthshs asas asas dasdads sadasd
asdad 1 2 3 5 6 7 8
:test only..
当我收到电子邮件时,格式已更改。数字 7 接近数字 8,间距减少到 1
test1
test
zzzyyy trsthshs asas asas dasdads sadasd
asdad 1 2 3 5 6 7 8
:test only..
如何保留具有多个空格的格式..
我使用了这段代码。
Set objCDOMail = Server.CreateObject("CDO.Message")
Set objCDOMail.Configuration = cdoConfig
objCDOMail.BodyPart.Charset = "UTF-8"
objCDOMail.HTMLBody = sBodyText
How can i convert space and tab in my email. kindly see below example.
test1
test
zzzyyy trsthshs asas asas dasdads sadasd
asdad 1 2 3 5 6 7 8
:test only..
when i received the email the format was changed. number 7 was near to number 8, the spacing was descreased to 1
test1
test
zzzyyy trsthshs asas asas dasdads sadasd
asdad 1 2 3 5 6 7 8
:test only..
how can I retain the the format to have multiple spaces..
I used this code.
Set objCDOMail = Server.CreateObject("CDO.Message")
Set objCDOMail.Configuration = cdoConfig
objCDOMail.BodyPart.Charset = "UTF-8"
objCDOMail.HTMLBody = sBodyText
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 CDO.Message 发送消息,可以使用 .TextBody 属性以纯文本形式发送消息,也可以使用 .HtmlBody 属性以 HTML 形式发送消息,如上面的代码片段所示。如果您使用纯文本,由于在收据上典型的电子邮件阅读器中它应默认为等宽字体,因此您的手动间距将被保留。如果您需要以 HTML 形式发送,那么您需要根据 HTML 的呈现方式来格式化文本 --- 无论是电子邮件还是 Web 浏览器。您必须记住,默认情况下 HTML 会自动折叠相邻空格。因此,如果您需要格式化文本,则需要对 DIV 标记中的文本块应用正确的样式,或者可以使用 HTML PRE 标记来表示预格式化文本。
You can send a message using CDO.Message either as plaintext using the .TextBody property or as HTML using the .HtmlBody property as in your code snippet above. If you use plaintext, since it should default to a mono-spaced font in typical email reader on receipt, your manual spacing would be preserved. If you need to send as HTML, then you need to format the text according to the way HTML is rendered --- doesn't matter that it is email or in a web browser. You have to keep in mind that HTML will automatically collapse adjacent spaces by default. So if you need to format the text, you need to apply the proper styles to the block of text in a DIV tag or you can use the HTML PRE tag to denote preformatted text.
当您使用 HTML 电子邮件格式时,请在发送邮件之前尝试对邮件使用 HTML 编码。
这会将邮件中的空格更改为 HTML 空格特殊字符 ( )
While you are using HTML email format, try to use HTML Encoding for the message before to send it.
this will change the spaces in the mail to HTML space special character ( )
您的文本不是 HTML,因此请勿将其分配给
HtmlBody
属性。而是使用:Your text is not HTML so don't assign it to the
HtmlBody
property. Instead use:要替换空格、制表符、换行符,您可以执行以下操作...
HTH
To replace, white space, tab, line feeds, you can do the following...
HTH