1

I have the script like this:

document.getElementById("cfsubmit").addEventListener("click", function() {
 var check = document.getElementById("cfemail"); // Get checkbox element
 var formEl = document.forms.cityfibre_form; // Get the form
 var formData = new FormData(formEl); // Creates form object

 // Get all form data values
 var cableRoute = formData.get('proposed_cable_route');
 var buildingPost = formData.get('building_post_2000');
 var asbestosReport = formData.get('asbestos_report');
 var surveyorName = formData.get('surveyor');
 var latitude = formData.get('latitude');
 var longitude = formData.get('longitude');
 var jobAddress = formData.get('address');
 var jobPostcode = formData.get('postcode');
 var propertyBlock = formData.get('cf_property_block')
 var propertyBlockNumber = formData.get('cf_number_of_blocks')

 var subject = "Submission from " + surveyorName;

 var body = 'Surveyor:' + surveyorName + '\n' 

 + 'Proposed Cable Route: ' + cableRoute + '\n'
 + 'Is the building post 2000: ' + buildingPost + '\n'
 + 'Do you have asbestos report: ' + asbestosReport + '\n'
 + 'Latitude: ' + latitude + '; Longitude: ' + longitude + '\n'
 + 'Address: ' + jobAddress + '; Postcode: ' + '\n'
 + 'Property blocks (Y/N): ' + propertyBlock + '; Number of property blocks: ' + propertyBlockNumber + '\n'
;


var mailTo = "mailto:mk@gmail.com?subject="+encodeURI(subject)+"&body="+encodeURI(body);

if (check.checked == true) { // If checked then fire
let link=document.createElement("a"); // Creates <a> element in DOM
link.href = mailTo; // Adds mailto link to <a>
link.click(); // Clicks the <a> and open default mail app
link.remove();
mainForm.submit();
}

mainForm.submit(); // Submits the form
});

and I would like to make the text bold within the '' quotes.

I tried something like this:

  + '<b>Proposed Cable Route:</b> ' + cableRoute + '\n'

but in my email body I am literally getting Proposed Cable route

I tried also this solution:

bold specific word in email body while sending it through googlescript

but after applying at the beginning and the end of my var body i had nothing.

I am thinking also about this solution:

https://webapps.stackexchange.com/questions/54670/send-html-email-from-a-spreadsheet-using-a-different-alias

But it looks like is not suitable for me.

How can I make this text emboldened?

Geographos
  • 827
  • 2
  • 23
  • 57
  • It’s not possible at all to add a bold style of font in herf mailto attribute. See https://www.ietf.org/rfc/rfc2368.txt – stacj Jul 13 '21 at 14:47
  • Yes, I see, that it's not possible. I will turn this string into capital letters instead then. Thank you! – Geographos Jul 13 '21 at 15:33

0 Answers0