I'm currently writing a functionality, whereby the users will click on a particular email and this will be added to a list in the local storage, thereafter, the user will click a button, essentially that button should popular a href tag, so that all the mail addresses are copied to user's default email settings (in my case outlook).
My question is how do you convert this into an email format?, I have tried loading it into the tag and it works, but then Django interprets this as a URL, not a mailing list?
So far I have the following:
<td class="virtualTd" onclick="putThis(this)">{{ client.email }}</td>
<script>
const emails_list = []
function putThis(control) {
var email = control.innerText;
emails_list.push(email);
}
</script>
This populates an array with all the addresses,
Thereafter, the user can click this button to load the data in to local storage, with the ultimate intention to load the outlook email
<a href="#" id="sendEmail" class="btn btn-primary" onclick="popEmail()"> Email Client </a>
<script>
function popEmail() {
const jsonArr = JSON.stringify(emails_list);
localStorage.setItem("array", jsonArr);
const str = localStorage.getItem("array");
const parsedArr = JSON.parse(str);
console.log(parsedArr);
var a = document.getElementById('sendEmail');
a.href = parsedArr;
}
</script>