[Javascript] Forward email onClick

David T. Lovering dlovering at gazos.com
Fri Oct 31 10:03:20 CST 2003


Yes, but unfortunately the mechanism will be slightly different for each browser and/or email
client.  Do you have any preferences (aside from outlook)?

Also, the link will need to be embedded in the email BEFORE receipt, as I know of no easy way
to "modify" incoming email on-the-fly.  If such a thing were possible, it would be VERY BAD!

One way you could do this (albeit crudely) is to use JavaScript to launch Outlook, pass
the parameters (complete with Cc, etc.) in "?xxx=xxx&xxx=xxx" format, but tie the "window" to 
a hidden and non-displayed IFRAME.  Yes, yes, I know the security arguments against this --
but if you are using Outlook you are already a dead-man-walking anyway.  Strange though it may
seem, there are fewer exploits against Outlook Express than there are against Outlook.  I saw
three more posted this morning in fact.

I believe if you launch Outlook (shudder!) from a command window with the appropriate flags it
will display all the command-line parameters necessary to do as you describe.  HOWEVER (!!!!)
it does not use standard CGI passing structures, but rather space-delimeted /command argument
pairs.  For example, to launch Outlook the cmd line might look like this:

var outlookCmd = "\"C:\\Program Files\\Microsoft Office\\Office10\\Outlook.exe\" /c ipm.note";

and to attach a pre-existing file to it

outlookCmd += " /a \"C:\\Windows\\Desktop\\myfile.txt\"";

obviously, there are a lot of other highly undocumented command parameters.  I'm sure someone has
hacked them all and posted a list somewhere.  The list from Microsoft is pretty lame, and only
includes the 21 most useless things possible.

The more general solution is to use the form declaration

action="mailto:somebody at somewhere.com?subject=Something%20Or%20Other"
with a "POST" method, and an enctype of "html/text" will get you started.  There are
about 40 or so possible sub-commands possible with this approach, including forwarding, saving
to file, Ccing, Bccing, etc.  Building a custom form around your handler usually works, providing
you've prefiltered its content for "unacceptable" strings and characters.

One of these days I'll sit down and build an 'app-hacker' that pulls out all the objects reachable from an application window (in tree form), and makes them accessable in a tidy and alphabetized list in a window running my chosen script.  I've done it
before (in a rather ad-hoc way), but in theory it should be possible to generalize for any application, as Micro$oft's window manager is remarkably easy to fool.

-- Dave Lovering

Clancy Jones wrote:
> 
> Hi, is there any way to use HTML/Javascript to forward an email when a
> link is clicked?  ie.  When viewing an HTML email in Outlook (for example)
> can I have a link which has the same effect as clicking the "Forward"
> button in Outlook and allows me to populate the CC field?
> 
> eg. Something like <a href="forwardto:user at domain.com?cc=admin at client.com">
> 
> Any ideas?
> 
> Thanks,
> Clancy
> 
> _________________________________________________________________
> Find your perfect match @  http://personals.xtramsn.co.nz   with XtraMSN
> Personals!
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list