CS155 Email Script
You can use this server side script to send automated emails from client-side JavaScript. For example, clicking this client-side hyperlink will cause an email to be sent by the crypto.stanford.edu server. Another copy of the email always goes to ikhare+cs155pp3@gmail.com so that we can monitor abuse and you can receive credit for your work.
javascript:void((new Image()).src='http://crypto.stanford.edu/cs155/hw_and_proj/proj2/sendmail.php?' + 'to=youremailhere@stanford.edu' + '&payload=xyz' + '&random=' + Math.random());
The random argument is ignored, but ensures that the browser
bypasses its cache when downloading the image. We suggest that you use
the random argument in your scripts as well. Newlines are not allowed
in javascript: links; if this bothers you, try
URL encoding.
The void(...);
construct prevents the browser from
navigating to a new page consisting of the contents
of the expression (which is what it normally does when it encounters a
non-void expression like javascript:2+2
).
Test form
If you just want to try out the script, you can use this form. (For the programming project, you'll probably want to use the JavaScript image technique shown above.)