Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29758

Google Apps Script Line Separation

$
0
0

When I ask the script to send email as HTML everything is all in one line. If I do text only, each line is separated. Is there a way to separate each line of the responses?

function SendGoogleForm(e) 
{  
  try 
  {      
    var email = "ma*******@email.com"
    var subject = "";  
    var s = SpreadsheetApp.getActiveSheet();
    var columns = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];    
    var message = "";         
    for ( var keys in columns ) {
      var key = columns[keys];
      if ( e.namedValues[key] && (e.namedValues[key] != "") ) {
        message += '<strong>' + key +  '</strong>' + ' --> '+ e.namedValues[key] + "\n\n";
      if (key === "Location") 
        subject += e.namedValues[key] + ""; 
      }
    }

    GmailApp.sendEmail(email, subject, "", { htmlBody: message});

  } catch (e) {
    Logger.log(e.toString());
  }

}


Viewing all articles
Browse latest Browse all 29758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>