为什么 SMTP 邮件将主题文本放入电子邮件正文中,而异常信息为“空白”?

发布于 2024-10-21 11:53:57 字数 1204 浏览 1 评论 0原文

这是一个远景。我不知道为什么会发生这种情况,我希望这是其他人遇到的事情。

我有一个电子邮件实用程序,每当用户遇到错误时,它都会向我发送一封电子邮件,我这样使用它:

MyUtility.SendEmail(shortNTID,
                    "[email protected]",
                    new string[] { "[email protected]" },
                    "Application error has occured for user: " + shortNTID,
                    "Message: " + ex.Message.ToString() +
                    " Source: " + ex.Source.ToString() +
                    " Target Site: " + ex.TargetSite.ToString() +
                    " Stack Trace: " + ex.StackTrace.ToString());

现在由于某种原因,今天我从应用程序收到了一些电子邮件,其中的主题和正文中包含此内容:

发生应用程序错误 用户:示例用户<​​/p>

该文本只能出现在主题中。此外,消息正文的其余部分是空白的,但显然应该有异常详细信息。

重申一下,这有两个奇怪的事情:

  1. 我已经使用“查找”在我的应用程序中搜索了“用户发生应用程序错误:”,并且只有几个地方,并且我在应用程序中没有此文本。消息正文。
  2. 该电子邮件应该在消息正文中包含所有异常信息,但电子邮件除了“用户发生应用程序错误:示例用户”这句话之外什么都没有,

您知道发生了什么吗?

This is a long shot. I have no idea why this is happening, and I am hoping this is something someone else has run into.

I have an email utility that sends me an email whenever a user gets an error, and I use it like so:

MyUtility.SendEmail(shortNTID,
                    "[email protected]",
                    new string[] { "[email protected]" },
                    "Application error has occured for user: " + shortNTID,
                    "Message: " + ex.Message.ToString() +
                    " Source: " + ex.Source.ToString() +
                    " Target Site: " + ex.TargetSite.ToString() +
                    " Stack Trace: " + ex.StackTrace.ToString());

Now for some reason today I got some emails from the application that had this in the subject AND the body:

Application error has occured for
user: Example User

That text should only be in the subject. In addition, the rest of the message body was blank, but obviously should have exception details.

To reiterate, there are two wierd things about this:

  1. I have done a search through my application using "Find" for "Application error has occured for user:" and there are only a few places, and nowhere do I have this text in the message body.
  2. The email is supposed to have all that exception information in the message body, and the emails had nothing but that sentence "Application error has occured for user: Example User"

Any ideas what is going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

☆獨立☆ 2024-10-28 11:53:57

Richard,

检查 ShortNTID 变量中是否嵌入了逗号 [不太可能影响代码,但是...!!] (,),特别是检查 ex事实上不为空。

只是一个很长的镜头...

Richard,

Check that there isn't a comma [unlikely to affect code, however...!!] (,) embedded inside the shortNTID variable and especially check that ex is in fact not null.

just a very long shot...

全部不再 2024-10-28 11:53:57

好吧,所以我只是愚蠢。我的实用程序中的 SendMail 方法已重载,其中一个重载在将主题放入邮件时出现错误。问题解决了。感谢大家对我的幽默和尝试。 。 。

Ok so I'm just dumb. My SendMail method in my utility is overloaded and one of the overloads had a mistake where the subject was getting put in for the message. Problem solved. Thanks to all of you for humoring me and trying. . .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文