HTML Email

What some of you may not know is that much of the time at Salesforce was spent in the world of electronic mail (or email for short). Email is interesting and relevant today because almost everyone has it and communicates with it. It is an official form of communication.

What you may not understand is that the world of email is rather confusing. Basically, the email that comes over the wire is presented to you by your email client and where email gets very confusing is that there are a million different email clients. You probably use more than one. If you look at your email on a mobile device and on a computer that is two different clients. Then when you think about 3rd party clients and even GMail which renders in a browser, you have a client which is actually a client within a browser.

Because of the various numbers of email clients and security concerns, while the web has advanced, email was still written and styled like the early 2000s web. This means table layouts, no real stylesheets, and things like the center tag from way back in the day.

When I left Salesforce, I was hoping that my email wondering days were behind me. Well, for the most part, they are, but one common thing our clients need is to send emails to their clients. Bringing me back to writing stylized email HTML like the 2000s in table layouts.

Despite being very forward-thinking when it was first created, Gmail is usually the hardest client to style for. It’s not really their fault. They are presenting your email in a web browser and they have to be secure on their side of things. I don’t begrudge them thinking about branding and security. Still, things are starting to change and Gmail is now supporting some new things:

Gmail isn’t the only client, though. Because of this, much of the email stuff is still being done with tables. This is pretty challenging for those of us who have spent a bunch of time learning to do things right in CSS (though, to be fair, I’m not the best at CSS).

The association for me feels a bit like the Cobal programmers who were needed to fix all the old code used before the year 2000. Granted, we have better tools for conversion, but this does feel a little archaic.

A Good resource is:

https://www.udemy.com/course/html-email/ – a good course on how to work through HTML email.

I’m learning more things as I go through this process. So far, I’ve learned that not all divs are respected and also that you have to use a capital M in margin for outlook. You also cannot use SVGs in email, you must use PNGs. More lessons to come as I dig through this project.

New Home

It’s taken me a fair amount of time to do this transition. I’ve been switching from LunarPages to DreamHost for a while now. LunarPages just stopped being up to date with all the technologies I needed in order to host all the projects I wanted, but I was (sort of still am) worried about moving from host to another. My primary email is associated with this domain (zacharyc.com). Also, I had a lot of secret hidden files and tools placed around the old website that I had been collecting pretty much since college (when I first started using lunar pages). Yes, that was over 13 years ago.

Lets define the type of technologist I am: I enjoy solving technical problems, but time is limited and there are too many problems for me to be an expert in all of them. I don’t want to be an email expert, but I do want email. I don’t want to be a server administrator but I do want my servers to be secure. So I pay other technologists to worry about those problems so I can worry about the ones I need to worry about. If I spent the time it would take to be an expert in those, I wouldn’t have the time to do all the other things that I want to do.

Looks like DreamHost is doing a pretty good job at meeting my needs. The move was stupid easy. When hosting a new domain on DreamHost, there is a checkbox for them to host Google Suite. All you have to do is check that box, and point the name servers to dream host and the magic works. I keep sending test emails to make sure they are still going through, but so far so good.

Also of note, I’m using a new theme here. I found it when I created a temp backup of my WordPress site on WordPress.com. The theme is called Independent Publisher 2. It’s not easily accessible from the themes download but it is public at GitHub: https://github.com/Automattic/themes/tree/master/independent-publisher-2 and it is working great on installation here. Had to do a couple of tweaks to get it where I wanted to be. I dropped the side bar on the main pages, and moved search to the footer. Other than that, pretty smooth.

Writing a Safari Extension

I’ve switched to using Safari as my primary browser. It works pretty well because I use it on all my devices so passwords and bookmarks are available on all devices.

The one downside, the developer community isn’t as big. We use Github at work for all of our repositories. Github code diffs are constrained by the width of their center column. On larger diffs this can make it hard to see all of the code without tons of scrolling. There is a chrome extension for this task, but there hasn’t been a safari extension for this same task, so I decided to write one.

I have worked on several chrome extensions in the past, so I thought this would be pretty easy, but there are a couple of challenges that I didn’t expect in completing the code. I’d like to share my experience with anyone else starting to write an extension, so hopefully you don’t run through the same issues that I did.

Firstly, you can see the code I used to make the extension here.

This essentially takes something like this:
Narrow Github

and turns it into something like this:

Wide Github

Here are some of my tips for writing a Safari Extensions:

  • If things aren’t working the way you expect, don’t trust the reload. Restart the browser!
  • Even if you just want to do something simple, you need to have a base html page. This page can hit your javascript, but you need to follow the developer instructs.
  • Your HTML page can listen for events and then send actions to your javascript, but you have to listen to all commands and filter out the ones you don’t want.

While I’ve shared my extension with a coworker, I’m pretty sure I”m the only one who uses it. You an download the extension from here.

Comments and suggestions are welcome.

Properties in C#

I’m a new C# programmer. I’m using it for a project at work. Doing an ASP.NET MVC project. So far I’ve been very happy with the language. It has some nice stuff built in. ASP.NET MVC is pretty nice too. It’s almost as easy to use as rails. So, all in all, I’m pretty happy, but today I ran into something stupid.

I have a method that is trying to do a TryUpdateModel(model, new[] {"prop1", "prop2"}); call and my model wasn’t getting updated. I checked out the associated FormCollection and sure enough my values were in it. The problem was in how I was defining my model.

public class MyModel
{
   public int prop1;
   public DateTime prop2;
}

Can you see the problem?

It took some digging, but it turns out that prop1 and prop2 as defined above are not properties. They are public members of the class MyModel. In order to be properties you need to assign them getters and setters like so:

public class MyModel
{
   public int prop1 { get; set; }
   public DateTime prop2 { get; set; }
}

My frustration is that prop1 and prop2 from my perspective as a consumer don’t really change with the new definition. It seems weird I should have to do that. I’m a new C# programmer and I totally believe that in 3 months more of working with this language I might become a purist and understand the reason to have these things behave differently, but for someone new to the language this isn’t the most intuitive approach.

Handspringman.com

For those of you who have known me for more than, say, five years, you know that one of my original web properties was handspringman.com. Unfortunately, due to issues with the way domain registration works, it slipped out of my control. At the time it was prohibitively expensive to reposes (somewhere in the several hundred dollar range).

Well, good news, it’s coming home. I recently checked it’s availability on GoDaddy and was able to procure it relatively inexpensively. I will do my best to put something up there soon.

Modified JustSimple WordPress Theme

I’m not much of a PHP guy, but I chose WordPress for this blog because I feel it is the most stable, well refined, yet easy to use blogging tool out there. Once the platform was decided I started looking for themes that worked well. I finally found something that I really liked when I stumbled on Ciaran Walsh’s blog. The theme is called JustSimple.

It’s a great theme, and I enjoy it on my site, but there areas where it has come up short. Mostly in styles for certain elements. I started a simple github project for my changes to JustSimple Project. One such change I’ve made is to add support for Definition Lists. Terms are bold and definitions are padded left.

If you want, you can download the theme from github (with a shameless use of the definition list):

Zip Format
Zip File
Tar Format
Tar File