开发者

Why is SMTP mail putting the subject text into the body text of the email, and exception information is "blank"?

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,
                    "support@mycompany.com",
                    new string[] { "supportlist@mycompany.com" },
                    "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?


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...


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. . .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜