Building Your Startup: Refining Email Templates

Final product image
What You'll Be Creating

This tutorial is part of the Building Your Startup With PHP series on Envato Tuts+. In this series, I'm guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. Every step along the way, I'll release the Meeting Planner code as open-source examples you can learn from. I'll also address startup-related business issues as they arise.

In this tutorial, I'll be refining the responsive, HTML email templates that Meeting Planner uses to send out invitations, notifications, reminders, and account-related messages.

During the initial stage of Meeting Planner development, I've focused primarily on functionality and have not yet invested significantly in design or hired a designer. Today's goal is to clean up the appearance of the existing HTML templates so that the basic emails are more readable and usable for people.

Likely half of people's first experience with Meeting Planner will be via a Meeting Request email.

If you haven't tried out Meeting Planner yet, go ahead and schedule your first meeting. I do participate in the comment threads below, so tell me what you think! You can also reach me on Twitter @reifman. I'm especially interested if you want to suggest new features or topics for future tutorials.

As a reminder, all of the code for Meeting Planner is written in the Yii2 Framework for PHP. If you'd like to learn more about Yii2, check out our parallel series Programming With Yii2.

Messages and Templates

The Early Templates

Initially, I used basic frameworks I found on the web to create early emails for Meeting Planner. They worked acceptably for the early development phase.

Here's an example of our existing HTML emails; they're functional but not very appealing. And, overall, I've decided that people don't need this many options and links within their invitations. It was time to reduce the plethora of options for a simpler experience.

Meeting Planner Templates - Original HTML Invitation Template

Even with the templates I'd used, email tables often appeared corrupted without easy explanation:

Meeting Planner Templates - Example of Corrupted View of Invitation in Gmail

I'd been preparing to migrate to more professional email templates, but it was definitely overdue.

The Variety of Messages 

Here's a summary of the messages that Meeting Planner regularly sends today:

  • meeting requests (i.e. invitations)
  • meeting updates for changes (also known as notifications)
  • meeting confirmations with calendar file attachment
  • meeting reminders
  • requests for contact information for an upcoming meeting
  • password reset requests

For the alpha test, I'm hoping I can reach a reasonable aesthetic baseline by applying open-source templates to be found on the web. At a later date, we'll hire a designer to invigorate the templates, theme and brand together.

I began scouring the web for the best email templates.

Open-Source Template Resources

There are a number of helpful guides like these:

And a number of providers offer open-source templates of their own:

Initially, I was drawn to the Mailgun templates as I felt they were thoroughly tested and I could build on them, but ultimately, I decided to go with Sendwithus's Oxygen email templates. Sendwithus is a synergistic marketing platform for Mailgun (or potentially other email providers), but I don't have experience with their overall service.

Oxygen offered a complete family of templates for useful scenarios. It seemed simple, organized, and easily extensible:

Meeting Planner Templates - The Send With Us Oxygen Templates

It's kind of them to offer their open-source email templates without requiring you to be a paying user. Go open source!

Integrating the New Templates

As an MVC framework, Yii separates layouts from body content. So I needed to break down the templates and monitor differences between variations within a group.

You can download the Oxygen family of templates from the Sendwithus GitHub, but they've not clearly divided the standard style elements common to each template, so you have to do that yourself.

It took some time to choose which templates I preferred, which elements I liked in each, and which CSS should be integrated into the layout.

Separating the Layout

Ultimately, here's the new HTML layout (I've truncated the styles here for readability):

Replacing the Common Elements

Within the templates, I had to replace a number of elements:

  • Logo
  • Supporting images 
  • Links

I created a logo file that would work for now, and I statically hosted it and the helper images, e.g. for Twitter, on Meeting Planner's server.

Meeting Planner Templates - Logo

I also replaced the default links within the email with code for our site links.

Building a Footer Section

To simplify reuse across the application, I separated the code for the footer:

Updating the Existing Templates

To integrate the templates, I wanted to start with the easiest one. Moving around complex, unfamiliar CSS and HTML is never simple.

I began with our Password Reset email template.

Password Reset

I chose Oxygen's Welcome template shown below:

Meeting Planner Templates - Oxygen Welcome Template

Each of SendwithUs's individual templates can be previewed and tested on their Litmus account.

Here's our reset your password email now on an iPhone, much more aesthetically comfortable than before:

Meeting Planner Templates - Reset Your Password

I was a bit confused when the first Gmail attempts I received looked malformed to me. 

Meeting Planner Templates - Reset Your Password in Gmail

But reviewing their Litmus previews showed me that that's what they look like in Gmail:

Meeting Planner Templates - Oxygen Welcome in Gmail

I later learned that Gmail requires more inlining of CSS than other services. I'll guide you through repairing this in a future tutorial.

Here's the passwordRequestToken.php code that helped generate the above:

The Meeting Request

The invitation people receive as a request to meet is our most complex template. It's sharing a brief introduction, possible places, possible times, and sometimes a note.

For this, I used the Oxygen Confirm template:

Meeting Planner Templates - Oxygen Confirm Template

I thought the Shipping and Date Shipped boxes could be used for sharing Place and Date Time options, and it's worked fairly well.

Here's what the invitation looks like now:

Meeting Planner Templates - Meeting Request Template

Certainly, the basic aesthetic appearance is much better. In the future, I may do some work to level and equalize the vertical heights of the places and date times boxes.

Here's the invitation-html.php body code that helped generate the above:

What's Next?

Now that the basic templates have been updated, I'll begin working to repair their appearances in Gmail. And soon, we'll implement notifications and reminders using them.

While you're waiting for episodes about these features, schedule your first meeting and try out the new templates. Also, I'd appreciate it if you share your experience below in the comments, and I'm always interested in your suggestions. You can also reach me on Twitter @reifman directly.

I'm also beginning to experiment with WeFunder based on the implementation of the SEC's new crowdfunding rules. Please consider following our profile. I may write about this more as part of our series.

Watch for upcoming tutorials in the Building Your Startup With PHP series. There are a few more big features coming up.

Related Links



Related Articles