Forum Moderators: open

Message Too Old, No Replies

Adding Subject to email script

         

Lorel

6:24 pm on Oct 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been using the following script to protect emails but need to know how to add a subject to the email. I don't write JS so can someone tell me how to add this?

<script type="text/javascript" language="JavaScript1.2">
<!--
// Courtesy of 33333.net [eeeeeeee.net...]
// hide script
var stb_domain = "example.com";
var stb_user = "myname";
var stb_recipient = stb_user + "@" + stb_domain;
var stb_url = "mailto:" + stb_recipient;
var stb_visualName = "my name";
document.write(stb_visualName.link(stb_url));
// -->
</script><br>

astupidname

12:46 am on Oct 4, 2008 (gmt 0)

10+ Year Member



That's a good question, and I played around with it after a small amount or research, as I have not done this before myself. I could not get it to jump past the cc line of e-mail recipients and just jump straight to the subject line. So I had to add in ?cc=&subject= into the new variable stb_subj which you may note uses the other new variable stb_subjfill also, which is the contents of the subject line, and you should alter that to your desired text in quotes.
Note also this could be expanded to send to multiple recipients by adding more in after cc= , if desired, and seperate the names with a comma or semi-colon. Although if you do, you may want to create the additional names as variables much the same way your emails address is assembled here and then added in as a variable. If you need further advice about that just ask!
Right now the cc= is just a blank value to be able to skip past it and get to the subject line.
Note also I removed language="JavaScript1.2" from the script tag, as language= is no longer used, type="text/javascript" is all that is needed.

<script type="text/javascript">
<!--
// Courtesy of 33333.net [eeeeeeee.net...]
// hide script
var stb_domain = "example.com";
var stb_user = "myname";
var stb_recipient = stb_user + "@" + stb_domain;
var stb_url = "mailto:" + stb_recipient;
var stb_visualName = "my name";
var stb_subjfill = "Bogus subject description"; /*** Enter your subject description text here ***/
var stb_subj = "?cc=&subject="+stb_subjfill;
document.write(stb_visualName.link(stb_url+stb_subj));
// -->
</script>

astupidname

1:14 am on Oct 4, 2008 (gmt 0)

10+ Year Member



Errr aahh, I must have screwed up somehow when I was testing initially. Turns out that it will jump straight to the subject line without referring to the cc= line first. So in the var stb_subj you could remove the part that reads cc=&
So the var stb_subj line should be just like this if not using the cc=:
var stb_subj = "?subject="+stb_subjfill;

Lorel

3:23 pm on Oct 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks much. that works perfectly!