Nice to remember the little things

When a fellow developer came over to talk about sending an email from his tool and I had forgotten this little hat trick.  When you need to pop up an email in the event your software needed to send you some information (such as an unhandled exception), you can use something like this handy little tool.

public static void CreateEmail(string _to, string _subject,
    string _body = “”,
    string _cc = “”,
    string _bcc = “”)
    StringBuilder mailTo = new StringBuilder();

    if (!String.IsNullOrEmpty(_body)) mailTo.Append(“&body=”).Append(_body);
    if (!String.IsNullOrEmpty(_cc)) mailTo.Append(“&CC=”).Append(_cc);
    if (!String.IsNullOrEmpty(_bcc)) mailTo.Append(“&BCC=”).Append(_bcc);


Happy Coding!

About JohnHowell

I am a professional software developer with over 20 years of experience. I currently specialize in Microsoft technologies such as VS, TFS, C#, VB.Net, WCF, WPF, WW, etc.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s