Thanks for the replies, especially feherke's almost immediate and thorough one. I had seen window.location suggested for someone else on a similar issue, but I assumed the HTML window would be replaced. I see now that it doesn't - nice.
But the email fields don't seem to work right if there is more than one address. I tried separating the addresses with a semicolon, a semicolon plus a space, additionally surrounding the addresses with < >, and doing a separate "&bcc=user@example.com" for each one (something I found someone else suggesting on the internet, but it didn't change anything). Everything after the word "mailto:" all shows up in the TO line of the email, as is (including the "&BCC=etc."), and in some instances I get an additional bizarre insertion of a quotation mark between the first username and its @ character. I'm testing using Thunderbird, if it matters, but I need this to work with at least Thunderbird and Outlook, and it would be good if it worked with Outlook Express as well. (It is a somewhat closed system - it's part of a password-protected database application that I manage.) Here is one example of what was happening - this example is based on feherke's syntax with semicolon separators:
Code:
window.onload=function(){ location.href='mailto:me@here.org&BCC=user1@compuserve.com; user2@yahoo.com;' }
In my email software, the following shows up in TO, and nothing anywhere else:
Code:
me"@here.org&BCC=user1@compuserve.com;user2@yahoo.com;
To respond to other comments:
feherke said:
But that would be the user friendly way.
Not in this case - the user just clicked a button to tell the system to make the email, so making him then click a link on the next page as well would not be user-friendly.
BillyRayPreachersSon said:
Depending on your mail client, you might script an ActiveX control to do this. I know that Outlook & Notes can be scripted like this, so it might be your only way.
I don't have the tools to compile an ActiveX component (or the time to learn another programming language), and even if I did, I suspect it would be specific to a given email client. Anyway, if I can overcome everything except a length limit, I can live with that (for example, I could count characters as I build the string, and if necessary, break the list into pieces to make multiple email windows and let the user combine them).
Diancecht said:
Another way, depending on your requirements, is doing it server-side.
The user hasn't written the email content yet, so server-side isn't an option, I don't think - as far as I know I can't pop up a window in the user's email client from the server side, but can only send a mail directly. The users just want me to populate the recipient fields from the database and let them take it from there.
The user who currently most needs this feature has up to now used a text output feature to get a newline-delimited list of the addresses and copy/pasted into an already open Outlook window. I'm just trying to improve on that, including checking for malformed addresses, duplicates, etc.