Skip to content

Blog

A Simple Way to Generate Test Data

Good test data is as realistic as possible but isn’t from production. Leaks can happen on test systems as well and they are often less protected as production systems. Whenever you need test data you can start creating it from scratch or write a tool. Both options take time and effort. However, there is a third option: test data generators. Today we look how you can create realistic test data without much effort.

5 Great Plugins for WordPress

The plugins for WordPress are uncountable. But not all are up-to-date and work with the newest version. The result are countless hours spent finding the right plugin for the job. Today I want to share 5 plugins that are a great help for me running this blog.

A Quick Overview on Hangfire.io

Hangfire.io is a nice tool to perform background processing in .Net. Those background jobs can go from simple method calls you don't want to block the user interface for up to recurring tasks for maintaining your application. It's licensed under the LGPL v3 and can be used in closed source software. Should you need more features or support, you can take the Pro version.

Paste XML as Class in Visual Studio 2017

A very helpful feature in Visual Studio 2017 is Paste Special. You can copy a XML or JSON file to the clipboard and paste a class definition that matches your file. That doesn't sound like much but it can help you to save a lot of time - especially when your XML file has no namespaces and no schema.

Embedding your Company Logo in Emails sent with C

Sending emails with C# is straightforward. You only need a few lines of code and a bit of configuration for the mail server as described in an earlier post. Taking the effort to send an email as a base line, you could jump to the conclusion that it shouldn't be a problem to display your company logo inside your generated emails. But unfortunately it's not that easy. That logo should be displayed in the content of the email and not just be added to the list of attachments. And embedded images are a totally different story.

What seems to be an easy task can take hours. However, if you are willing to take some dirty shortcuts you can implement that requirement in a few lines of code.

Saving Emails to Disk in C

Sending emails in C# is a simple task. All you need is a MailMessage object with your email and a SmtpClient to send it:

var toAddress = "[email protected]";
var fromAddress = "[email protected]";
var message = "your message goes here";

// create the email
var mailMessage = new MailMessage();
mailMessage.To.Add(toAddress);
mailMessage.Subject = "Sending emails is easy";
mailMessage.From = new MailAddress(fromAddress);
mailMessage.Body = message;

// send it (settings in web.config / app.config) 
var smtp = new SmtpClient();
smtp.Send(mailMessage);