0

Before getting too far into the what I need, I want to start out that my HTML is not connected to an internal/external server (from what I have read this may be limiting my options). I really am using it as an HTML form that my employees will be able to have a standard template when sending emails. I am still really new to this so I apologize in advance if I forgot to include some important information.

I have a form that my employees will have to fill out and click a generate email button. I have everything working except the ability to format the email body. What I need to do is Bold all the Text before the answers. (IE Region: selection here) I have shorten my code to spare you how inexperienced I am.

function sendEmail() { 

let reg1 = "<b>Region Name:</b> "
let reg2 = "Region Name: "
let a = document.getElementById("reg").value;

let m_to = " Main Email Addresses here"
let m_cc = "CC Email Addresses here"

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;

document.location.href = "mailto:" + encodeURIComponent(m_to) + "?cc=" + encodeURIComponent(m_cc)
+ " &subject=DEAP Activation " + encodeURIComponent(b) +": NE Region " + today
+ " "
+ "&body=" 
+ "%0D%0A%0D%0A"
+ encodeURIComponent(bl) + "%0D%0A%0D%0A"
+ "Region Name: " + encodeURIComponent(a) + "%0D%0A"

}

I have tried:

  1. + reg1 + encodeURIComponent(a) but that will display as <b>Region Name:</b>
  2. reg2.bold() + encodeURIComponent(a) but that yielded the same result as above
  3. reg2.bold + encodeURIComponent(a) that displayed as function bold() { [native code] }
  4. I also tried to change + "&body=" to + "&htmlbody=" but that stopped the email form generating

Any help would be greatly appreciated

Kavorka
  • 306
  • 3
  • 10
  • Seems like it's impossible to have HTML formatting in the message, see [mailto link with HTML body](https://stackoverflow.com/questions/5620324/mailto-link-with-html-body) – Vitalii Feb 16 '21 at 22:04
  • Looks like there is one option available (from the same post) https://stackoverflow.com/a/46699855/14596856 – Vitalii Feb 16 '21 at 22:08
  • Thank you @Vitalii, I will see about getting that implemented – Kavorka Feb 19 '21 at 14:55

0 Answers0