Sending personalised automated email once form is complete - In HTML format ideally...

39 views
Skip to first unread message

Tom Manzoni

unread,
Dec 1, 2020, 5:34:29 PM12/1/20
to Google Apps Script Community
Hi All,

Pretty new to coding but I have managed to put together a script that automatically sends out an email once someone has completed a form...

function JobAdvertEmailer(e) {
  var Timestamp = e.values[0];
  var JobTitle = e.values[1];
  var Location = e.values[2];
  var Salary = e.values[3];
  var Adjective = e.values[4];
  var Desc = e.values[5];
  var Res1 = e.values[6];
  var Res2 = e.values[7];
  var Res3 = e.values[8];
  var Res4 = e.values[9];
  var Res5 = e.values[10];
  var Res6 = e.values[11];
  var Ben1 = e.values[12];
  var Ben2 = e.values[13];
  var Ben3 = e.values[14];  
  var Email = e.values[15];
  
  var Subject = "Completed Advert" + " - " + JobTitle + " - " + Location 
  var Message = //The message - Deleted as was quite long and irrelevant at this point...
  
MailApp.sendEmail(Email, Subject, Message)


This scripting works perfectly, to give you an insight I am creating a form that recruitment consultants can fill in and then get emailed the automatically generated advert to post to job boards etc.

The issue I'm having is that when the email comes through, I believe its due to it coming through as plain text and being limited to 69 characters per line - so when copy and pasting the completed advert from the email sentences are broken up in a new line etc.

I was looking for some guidance on how to create scripting which will allow me to send as HTML and would this fix the 69 character issue?

Any help would be much appreciated!

Thank you,
Tom 

Alan Wells

unread,
Dec 1, 2020, 6:27:26 PM12/1/20
to Google Apps Script Community
You'll need to use the special htmlBody parameter.

See:


The HTML can not have style tags and classes.
All styling must be in the element tag itself.
Not all CSS is allowed in the email.

CBMServices Web

unread,
Dec 1, 2020, 6:36:12 PM12/1/20
to google-apps-sc...@googlegroups.com
The 69 character limitation would not be fixed by HTML but your email text will look much better.

I suspect the limitation is due to the environment variable that you are using. You may need to index directly into the form response to see the full text or if you are saving form responses to a spreadsheet, index into the spreadsheet to get the complete text.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/61436948-e300-4667-8c58-fca461d3b9fdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages