Avatar

Correct answer by
Level 10

Hi Don,

If you look at the email line of script, you will see that I am adding the CC variable at the END of the cURL string.

event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody + vCC,cSubmitAs:vFormat,cCharset:"utf-8"});

vCC is put at the end of the mailto string because it starts with an "&cc=", which is missing from my script above. (in my defense I was scripting on the side of the road, from memory )

// Declare the variable

var vEmail;

var vCC = "";

// Check that the email field is not null

if (txtToAddress.rawValue !== null) {

     vEmail = txtToAddress.rawValue;

}

// Look at cc fields over three if statements

if (ccEmail.rawValue !== null){

     vCC = "&cc=" + ccEmail.rawValue + ";";

}

if (ccEmail.rawValue !== null && MEAdminEmail.rawValue !== null){

     vCC = vCC + MEAdminEmail.rawValue;

}

else if (ccEmail.rawValue === null && MEAdminEmail.rawValue !== null)  {

     vCC = "&cc=" + MEAdminEmail.rawValue;

}

// Send email

event.target.submitForm({cURL:"mailto: " + vEmail + "?subject=MAR Assignment" + vCC,cSubmitAs:"PDF",cCharset:"utf-8"});

That should work,

Niall

View solution in original post