title: Send Email using HTML via Google Scripts
body: <p>I've created a script that will populate info from a Google Form into a template and email a generated PDF. I want to be able to customize the email it sends using HTML, but for some reason I can't get it to work the way I have with similar scripts in the past.</p>
  <p>Code below.
  With this code, the email outputs &quot;Please find your ML enclosed. &lt;_br/&gt;&quot; (but without the _... stackoverflow is actually reading the HTML and inputs a line break for me without it)</p>
  <p>I want the output to be &quot;Please find your ML enclosed.</p>
  <p>[linebreak]&quot;</p>
  <pre><code>    function onSubmit(e) {
    const rg = e.range;
    const sh = rg.getSheet();
    
    //Get all the form submitted data
    //Note: This data is dependent on the headers. If headers, are changed update these as well.
    const Email= e.namedValues['Email Address'][0];
    const Team = e.namedValues['Team'][0];
    const Name = e.namedValues['Name'][0];
    const Time1 = e.namedValues['time1'][0];
    const Adjective1 = e.namedValues['adjective1'][0];
    const LengthofTime1 = e.namedValues['lengthoftime1'][0];
    const Adjective2 = e.namedValues['adjective2'][0];
    const Number1 = e.namedValues['number1'][0];
    const Verb1 = e.namedValues['verb1'][0];
    const Verb2 = e.namedValues['verb2'][0];
    const Noun1 = e.namedValues['noun1'][0];
    
    //Build a new invoice from the file
    //Folder and file IDs
    const MLFolderID = '&lt;Folder ID&gt;';
    const MLFolder = DriveApp.getFolderById(MLFolderID);
    
    const TemplateFileID = '&lt;template ID&gt;';
    const newFilename = 'ML -' + TemplateFileID;
    
    //Make a copy of the template file
    const newTemplateFileID = DriveApp.getFileById(TemplateFileID).makeCopy(newFilename, MLFolder).getId();;
    
    //Get the invoice body into a variable
    var document = DocumentApp.openById(newTemplateFileID);
    var body = document.getBody();
    
    //Replace all the {{ }} text in the invoice body
    body.replaceText('{{team}}', Team);
    body.replaceText('{{name}}', Name);
    body.replaceText('{{time1}}', Time1);
    body.replaceText('{{adjective1}}', Adjective1);
    body.replaceText('{{lengthoftime1}}', LengthofTime1);
    body.replaceText('{{adjective2}}', Adjective2);
    body.replaceText('{{number1}}', Number1);
    body.replaceText('{{verb1}}', Verb1);
    body.replaceText('{{verb2}}', Verb2);
    body.replaceText('{{noun1}}', Noun1);
    
    
    document.saveAndClose();
  
  // define email variables
  var subject = 'Subject ML';
  var msgHtml = 
  &quot;Please find your ML enclosed.&quot; + &quot;&lt;br/&gt;&quot;;
  var attachment = DriveApp.getFileById(newTemplateFileID);
  
  //send email with the file
  GmailApp.sendEmail(Email, subject, msgHtml, {attachments: [attachment.getAs(MimeType.PDF)],   from:'email@gmail.com'});
    }
  </code></pre>