If you want to send HTML emails, you need to use a tool that let you write the content of the email yourself instead of relying on WYSIWYG editors.
The most part of mail clients doesn't allow this feature, mainly for security reasons.
With web email clients, such as Gmail, Yahoo or Hotmail, you can try to use the WebKit Inspector (in Safari and Chrome) or Firebug to edit the content of the email directly in the DOM, bypassing the interface restrictions. However, your code is likely to be sanitized by the application and it won't work as expected.
Best Answer
Usually you can write that into an HTML file, render it, and copy the email from the browser into Gmail's compose pane.