使用 CDO 在电子邮件正文中随机感叹号
我们在经典 ASP 中使用 CDO 对象在电子邮件正文中收到随机感叹号 (!) 标记。
我们在 Outlook 中没有看到这个感叹号。问题仅发生在 Lotus Notes 客户端上。我们使用 IIS SMTP 服务器来发送电子邮件。
编辑
Set myMail= Server.CreateObject("CDO.Message")
myMail.Subject="Business and Company News on your Mobile Device"
myMail.From="[email protected]"
myMail.To="[email protected]"
htmlbody = htmlbody (coming runtime)
myMail.BodyPart.ContentTransferEncoding = "quoted-printable"
myMail.HTMLBody = htmlbody
myMail.Send
我认为客户端没有使用 SMTP。但他们肯定正在使用 LotusNotes。
We are getting random exclamation (!) mark in email body using CDO object in Classic ASP.
We are not getting this exclamation mark with outlook. Problem only occur with Lotus Notes client. We use IIS SMTP server to send email.
Edit
Set myMail= Server.CreateObject("CDO.Message")
myMail.Subject="Business and Company News on your Mobile Device"
myMail.From="[email protected]"
myMail.To="[email protected]"
htmlbody = htmlbody (coming runtime)
myMail.BodyPart.ContentTransferEncoding = "quoted-printable"
myMail.HTMLBody = htmlbody
myMail.Send
I think client is not using SMTP. But they are using LotusNotes for sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
电子邮件中的感叹号通常是由于行太长造成的。将您在 ASP 中创建的电子邮件正文转储到文件中并检查它。尝试在合理的地方用换行符分割行。我假设这是一条 HTML 消息 - 将换行符放在适当的 HTML 标记后面。
Exclamation marks in emails are usually caused by lines being too long. Dump the email body you're creating in ASP to a file and examine it. Try to split lines at sensible places with newlines. I assume this is a HTML message - place newlines after appropriate HTML tags.
我在代码中看到的唯一区别是
So
HTMLBodyPart....
而不是BodyPart.....
不知道这是否有区别,但您可以尝试一下。
Only difference I see with my code is
So
HTMLBodyPart....
in stead ofBodyPart.....
Don't know if that makes a difference, but you can try it.
如果我没记错的话,“quoted-printable”解决方案可以工作,但它会产生二进制附件的问题。因此,我编写了一个小的 VbScript 函数来修复长字符串并使 htmlbody 与所有客户端兼容。这里是:
If I'm not wrong, the "quoted-printable" solution works but it generates problems with binary attachments. So I wrote a little VbScript function that fixes long strings and makes the htmlbody compatible with all clients. Here it is:
我发现的最好的解决方案是使用这段代码:
它似乎工作完美!
The best solution I found is to use this code:
It seems to work flawlessly!
当每行超过 750 个字符时就会发生这种情况。尝试使用 vbNewLine 或 Chr(10) 在 html 中分割行。
例子:
This happens when there are over 750 characters per line. Try use vbNewLine or Chr(10) to split lines in html.
Example: