Send Correctly Formatted HTML emails with Laravel and Swiftmailer

Lately I’ve been using Laravel for most of my development. It’s a great platform and nicely written but when it comes to sending HTML emails - it’s not setup correctly.

For those who don’t understand the mechanics of email allow me to clarify. At the head of most email messages is a piece of information called “content-transfer-encoding” which basically states the way the data is formatted. By default Laravel via Swiftmailer encodes HTML emails using “quoted printable” which can wreak havoc on HTML in your email.

Below is an example of a better way to encode HTML email messages using 8bit encoding.

Mail::send(“emails.welcome”, $input, function($message) use($input)  
  $message->to($input[‘email’],$input['name’])->subject(“Verify Your Account”);

Notie: This is an older post - originally posted to my tumblr blog in 2014. I have since moved on to a new blogging platform. Here it is again for your reference.