title: GmailMessage getBody's HTML output is not very clean
body: <p>Because Gmail's "canned responses" are not available from <a href="https://developers.google.com/apps-script/reference/gmail/" rel="nofollow noreferrer">Google Apps Script for Gmail</a>, I was trying the following: </p>
  
  <ol>
  <li><p>Send the template email to myself (let's say its Subject is Template_238) with traditional Gmail interface</p></li>
  <li><p>Load this email in Google Apps Script with <a href="https://developers.google.com/apps-script/reference/gmail/gmail-message#getBody()" rel="nofollow noreferrer">getBody</a>: </p>
  
  <pre><code>var mytemplate = GmailApp.search('Template_238').getMessages()[0];
  var body = mytemplate.getPlainBody();
  var htmlbody = mytemplate.getBody();
  </code></pre></li>
  <li><p>Then I can send it with:</p>
  
  <pre><code>GmailApp.sendEmail("test@example.com", "Sending a template", body, {htmlBody: htmlbody});
  </code></pre></li>
  </ol>
  
  <p>But I noticed that getting the HTML body of an already-sent-by-gmail email gives a dirty result:</p>
  
  <pre><code>&lt;div dir=3D"ltr"&gt;&lt;div&gt;&lt;span style=3D"font-size:12.8px"&gt;Hello,&lt;/span&gt;&lt;br sty=
  le=3D"font-size:12.8px"&gt;&lt;br style=3D"font-size:12.8px"&gt;&lt;span style=3D"font-=
  size:12.8px"&gt;Thank you for contacting us.&lt;/span&gt;&lt;br style=3D"font-size:12.8=
  px"&gt;&lt;br style=3D"font-size:12.8px"&gt;&lt;span style=3D"font-size:12.8px"&gt;We have=
   received your inquiry and will contact you soon&lt;/span&gt;&lt;br&gt;=
  &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=3D"gmail_signature"&gt;&lt;div dir=3D"ltr"&gt;&lt;=
  div&gt;&lt;div dir=3D"ltr"&gt;&lt;div&gt;&lt;div dir=3D"ltr"&gt;&lt;div&gt;Best regards,&lt;br&gt;&lt;/div&gt;&lt;div=
  &gt;&lt;br&gt;Myself&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Company&lt;/b&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;a hre=
  f=3D"http://www.example.com" target=3D"_blank"&gt;www.example.com&lt;/a&gt;&lt;=
  br&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=3D"http://www.facebook.com/example" target=3D"_bl=
  ank"&gt;www.facebook.com/example&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;img src=3D"http://www.exam=
  ple.com/logo.png"&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;=
  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I often see things like:</p>
  
  <pre><code>&lt;div class=3D"gmail-m_681872521129xxx6703m_-59021xxx267255=
  64285gmail-m_2008053448xxx413226gmail-m_-370479949603xxx4147gmail-m_5189037=
  0070xxx5842gmail_signature"&gt;&lt;div dir=3D"ltr"&gt;&lt;div dir=3D"ltr"&gt;&lt;div dir=3D"=
  ltr"&gt;&lt;div dir=3D"ltr"&gt;&lt;div dir=3D"ltr"&gt;&lt;div style=3D"font-size:small"&gt;&lt;div =
  class=3D"gmail-m_681872521129xxx6703m_-59021828267xxxx64285gmail_signature"&gt;=
  &lt;div dir=3D"ltr"&gt;&lt;div dir=3D"ltr"&gt;&lt;div dir=3D"ltr"&gt;&lt;div dir=3D"ltr"&gt;
  </code></pre>
  
  <p>even if my input was just some text, with a few links and bold text here and there.</p>
  
  <p><strong>Isn't there a cleaner way to get HTML of a mail with Google Apps Scripts for Gmail?</strong> (i.e. without so many div, so many 8469832649732649gmail_signature).</p>