• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

How to allow selection of multiple email recipients

I need Expert advice:
I have a pre-formatted email body containing an embeded link to a survey site that gathers job performance info on a particular employee.  The email is to be sent out to specific individuals. Currently, recipient email addresses must be manually entered by the user into the mock "BCC:" section of the email message. Please see the screenshot below.
Problem:  I want to replace the manual entry of email addresses with...
1.  A dropdown that would provide the User (typically, a manager) to select an individual and...as each is selected:
2.  To display the selected individual's email address in the mock BCC: email window
3.  Allow for multiple email addresses, separated by commas.

Note:  My database contains a table of all employees' email addresses and display names (from Active Directory).

Question:  How would YOU add this functionality to the program?  I code using ASP Classic (3.0...yeah, sorry, I'm a dinosaur).  I don't need code - but a detailed procedural explanation would help me out.  I'm able to "see it in my head," but I don't know how to execute it.
Thanks in advance for your advice!
2 Solutions
1- Add a multi-select box
2- User selects names from multi-select and "adds" them (added entries get removed from the list)

If you need to add "remove" functionality, I may change my mind... or just create a second select box of names that were added and let the user "remove" them from that box (you know... the old "move stuff from one select box to another using arrow buttons" dynamic)
Hi OgSan,

First, no need to apologize for using classic asp. It is still widely used by lots of companies.

A lot of our programs still run on classic asp.

Now, on to your issue.

This is how I would approach it.

First, create a checkbox list of email addresses (this, based on your requirements, will be sampled from the db).

This list will be encapsulated into a single show/how checkbox.

This way,  a user, clicks the checkbox to expose the list.

Select the email addresses to be included either your TO or BCC box.

THe number of email addresses selected will be separated by comma.

For some companies, the delimiter is semi colon (;).

Choose which one works for you.

Then all you would need is add to the form fieldname to your BCC box.

I have put together sample code but used statick checkbox.

You can easily convert it to dynamic variety by populating the checkbox list with data from the db.

***Markup : page1.asp
<title>Sample Email Lists</title>
<script type="text/javascript">
function ExposeList() {
  var status = document.getElementById('emailChoices').checked;
  if (status == true) { document.getElementById('EmailCB').style.display = "block"; }
                 else { document.getElementById('EmailCB').style.display = 'none'; }
<form name="emailist" method="post" action="page2.asp">
<input type="checkbox" id="emailChoices" onclick="ExposeList()">Show Customer Emails<br>
<div id="EmailCB" style="height:150;width:200px;overflow:auto;border:1px solid blue;display:none">
<input type="checkbox" id="emailLists" name="emailLists" value="email1@domain.com">Client One<br>
<input type="checkbox" id="emailLists" name="emailLists" value="email2@domain.com">Client Two<br>
<input type="checkbox" id="emailLists" name="emailLists" value="email3@domain.com">Client Three<br>
<input type="checkbox" id="emailLists" name="emailLists" value="email4@domain.com">Client Four<br>
<input type="checkbox" id="emailLists" name="emailLists" value="email5@domain.com">Client Five<br>
<input type="checkbox" id="emailLists" name="emailLists" value="email6@domain.com">Cloent Six<br>
<input type="submit" name="goto" value="Go">

Open in new window

***Email Code: page2.asp
emailLists = "'" & Request("emailLists") & "'"

'Ensure something is selected
	if emailLists = "" then
		'No items to update or delete
		Response.Write "You did not select any email address!"

'Now show selected email addresses

		emailLists = Replace(emailLists , ", ", "','" ) 'comma-separated list
		response.write emailLists
     End If

Open in new window

OGSanAuthor Commented:
Thanks for the ideas, nap0leon and sammySeltzer.  It's given me a starting point for my re-design.  There are some requirements that constrain my options that I did not want to get into - so I'm going to award points evenly...and will be no doubt posting later as I delve into the construction phase.
Thanks, again and have a Happy Holiday season, both of you!
Jeff (aka OGSan)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now