C#: How to send emails

Sending a basic email message in a C# application is quite easy thanks to a class called SmptClient. We simply need an address to send to, an address to send from, the message we want to send and the address of an SMTP server, hand it all to the SMTP client, and you’re done:

var from = new MailAddress("me@example.com", "Me");
var to = new MailAddress("you@example.com", "You");

var message = new MailMessage(from, to)
{
    Subject = "Greetings!",
    Body = "How are you doing today?",
};

var client = new SmtpClient("smtp.example.com");

using (client)
{
    try
    {
        client.Send(message);
    }
    catch (SmtpException e)
    {
        Console.WriteLine(e.Message);
    }
}

That was pretty simple, wasn’t it? But what if we need to authenticate with our server? And what if we want to send our message in a more secure manner?

Continue reading C#: How to send emails

Universal Greeting Time (UGT)

Stumbled over the concept of Universal Greeting Time on IRC a little while ago. Found it kind of brilliant :p

UGT (abbr.): Universal Greeting Time.
UGT is convention initially established in #mipslinux on irc.openprojects.net (now irc.freenode.net) but slowly taking over the world. It states that it is always morning when person comes into a channel, and it is always late night when person leaves. Local time of any member of channel is irrelevant. Resistance is futile. Your ass will be laminated. (geoman is exception to this rule – his ass will be fried instead).

Used as follows:
Good (UGT) Morning, Everyone! or good morning (ugt) (on entry to channel).
Good (UGT) Night – when leaving it.

The idea behind establishing this convention was to eliminate noise generated almost every time someone comes in and greets using some form of day-time based greeting, and then channel members on the other side of the globe start pointing out that it’s different time of the day for them. Now, instead of spending time figuring out what time of day is it for every member of the channel, we spend time explaining newcomers benefits of UGT.

Source: UGT

Good night!

How to enable verbose booting in Mac OS X

I’m a curious guy, so I wanted to see if there was anything interesting happening behind the Apple logo when the Mac I use at work boots up.

Turned out it was quite simple to enable and disable this feature. To enable it, just open up a Terminal and run the following command:

$ sudo nvram boot-args="-v"

When you reboot the next time, you will see all the fun stuff happening during the boot up. If you get tired of it, you can disable it again by running:

$ sudo nvram boot-args=

That’s it!