| View previous topic :: View next topic |
| Author |
Message |
RoverWrap
Joined: 04 Oct 2005 Posts: 2
|
Posted: Tue Oct 04, 2005 10:17 am Tell A Friend email |
|
|
|
I'm new at learning html, so this is probably a simple code. I'd like to have a link on my site that a person clicks to send an email to a thrid party. It should open that person's own new email window with a pre-written message in the subject line like, "I wanted you to see this site." I don't want it to be a form, but just a way to quickly open their own new email window. I'd also like the link to my site to be included in the body of that email. Is that possible?
Thanks! |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8271 Location: Castle Rock CO USA
|
Posted: Tue Oct 04, 2005 10:21 am |
|
|
|
Possible - yes but you will need some server side scripting, like ASP with JMAil, ASPMail, ASPEmail or PHP to handle it. |
|
RoverWrap
Joined: 04 Oct 2005 Posts: 2
|
|
Superpetauction

Joined: 07 Oct 2005 Posts: 47 Location: Logansport, Indiana
|
Posted: Sun Oct 16, 2005 5:03 am Stop E-Mail harvisting spiders |
|
|
|
I hope this helps stop all the spam
| Code: |
<table border="3" bordercolor="#000080" bgcolor="#EEEEEE" cellpadding="5" cellspacing="5" width="100" height="40" align="center">
<tr><td align="center">|
<script language="JavaScript">document.write ('<A HREF="mai')
document.write ('lto:you')
document.write ('@')
document.write ('your.com">email</a>')
</script> |
</td>
</tr>
</table>
|
 |
|
zylstra Site Admin

Joined: 10 May 2004 Posts: 125
|
Posted: Mon Oct 17, 2005 4:36 pm |
|
|
|
In this case I think Corey was wrong, and Superpetauction didn't know what you meant.
In case you want something simpler, or don't want to use Javascript:
| Code: |
| <A href="mailto:?subject=I wanted you to see this site&body=Check out http://www.mysite.com. It is very cool!Ciao!Me">Share This Page</A> |
And if you want a new line use & #11; with no space between the & and the #. |
|
Superpetauction

Joined: 07 Oct 2005 Posts: 47 Location: Logansport, Indiana
|
Posted: Tue Oct 18, 2005 1:52 am Re.. |
|
|
|
The one above stops E-Mail spiders from getting your email address
this one does the same thing as you posted but stops spiders and is a little fancier
| Code: |
<script language="JavaScript">
var initialsubj="Hello take a look at this E-Card"
var initialmsg="Hi:\n I found this page on a very nice site. Check it out: "+window.location
var good;
function checkEmailAddress(field) {
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
}
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {
//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
}
}</script>
</head>
<body>
<P ALIGN="center">
<form name="eMailer">
<font face="City" size="4" color="#ffffff">Send This To A Friend:</font><br>
<input type="text" name="email" size="26" value="Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
<br>
<input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
</form>
</P> |
|
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8271 Location: Castle Rock CO USA
|
Posted: Tue Oct 18, 2005 5:54 am |
|
|
|
You are right about that - I just like to rely more on the server rather than the user.
There are a few different ways to do it, but using server side language will be more reliable than relying on the user.
If you server supports JMail, this is what we developed.
In the form page:
| Code: |
<FORM METHOD="post" ACTION="confirm.asp">
<center>
<TABLE BORDER="0" CELLPADDING="7" CELLSPACING="0">
<% if request.querystring("err")<>"" then
sendername=session("sendername")
senderemail=session("senderemail")
newname1=session("newname(1)")
newemail1=session("newemail(1)")
newname2=session("newname(2)")
newemail2=session("newemail(2)")
newname3=session("newname(3)")
newemail3=session("newemail(3)")
newname4=session("newname(4)")
newemail4=session("newemail(4)")
newname5=session("newname(5)")
newemail5=session("newemail(5)")
user_message=session("message")
Select Case request.querystring("err")
Case 1
%>
<tr><td colspan="3" style="color: red">Email address for <%=newname1%> is not valid. Please retry ! </td></tr>
<%
case 2
%>
<tr><td colspan="3" style="color: red">Email address for <%=newname2%> is not valid. Please retry ! </td></tr>
<%
case 3
%>
<tr><td colspan="3" style="color: red">Email address for <%=newname3%> is not valid. Please retry ! </td></tr>
<%
case 4
%>
<tr><td colspan="3" style="color: red">Email address for <%=newname4%> is not valid. Please retry ! </td></tr>
<%
case 5
%>
<tr><td colspan="3" style="color: red">Email address for <%=newname5%> is not valid. Please retry ! </td></tr>
<%
case 6
%>
<tr><td colspan="3" style="color: red">Please enter your email!</td></tr>
<%
case 7
%>
<tr><td colspan="3" style="color: red">Please enter at least one email address !</td></tr>
<%
End Select
'response.write sendername
'response.end
end if%>
<TR BGCOLOR="#0000cc" ALIGN="center">
<TD COLSPAN="3"><font face="arial,helvetica,sans-serif" size="3" color="#ffffff">
<b>Do you like our site? Tell a friend!</b></FONT></TD>
</TR>
<TR BGCOLOR="#DDDDFF" ALIGN="center">
<TD><BR></TD><TH>Name</TH><TH>email</TH></TR>
<TR BGCOLOR="#EEEEFF" ALIGN="center">
<TH ALIGN="right">You:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="sendername" value="<%=sendername%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="senderemail" value="<%=senderemail%>"></TD>
</TR>
<TR BGCOLOR="#DDDDFF" ALIGN="center">
<TH ALIGN="right">Friend:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="newname1" value="<%=newname1%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="newemail1" value="<%=newemail1%>"></TD>
</TR>
<TR BGCOLOR="#EEEEFF" ALIGN="center">
<TH ALIGN="right">Friend:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="newname2" value="<%=newname2%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="newemail2" value="<%=newemail2%>"></TD>
</TR>
<TR BGCOLOR="#DDDDFF" ALIGN="center">
<TH ALIGN="right">Friend:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="newname3" value="<%=newname3%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="newemail3" value="<%=newemail3%>"></TD>
</TR>
<TR BGCOLOR="#EEEEFF" ALIGN="center">
<TH ALIGN="right">Friend:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="newname4" value="<%=newname4%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="newemail4" value="<%=newemail4%>"></TD>
</TR>
<TR BGCOLOR="#DDDDFF" ALIGN="center">
<TH ALIGN="right">Friend:</TH>
<TD><INPUT TYPE="text" SIZE="15" NAME="newname5" value="<%=newname5%>"></TD>
<TD><INPUT TYPE="text" SIZE="20" NAME="newemail5" value="<%=newemail5%>"></TD>
</TR>
<br><br>
<TR BGCOLOR="#EEEEFF"><TD ALIGN="right" VALIGN="top">
<font face="arial,helvetica,sans-serif" size="2">
<B>Your<BR>Message:</font></TD>
<TD COLSPAN="2">
<TEXTAREA NAME="user_message" COLS="35" ROWS="5" WRAP="on"> <%=user_message%></TEXTAREA>
</TD></TR>
<TR BGCOLOR="#EEEEFF" ALIGN="center">
<TD COLSPAN="3"><INPUT TYPE="submit" VALUE="Send Referral"></TD>
</TD></TR></TABLE>
</center>
</FORM> |
and then in the confirm.asp page:
| Code: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<% siteadmin="youremailatexample.com"
recsite="http://www.example.com"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Thank You</title>
</head>
<body>
<%
sendername=request.form("sendername")
senderemail=request.form("senderemail")
message=request.form("user_message")
dim newname(5)
dim newemail(5)
newname(1)=request.form("newname1")
newemail(1)=request.form("newemail1")
newname(2)=request.form("newname2")
newemail(2)=request.form("newemail2")
newname(3)=request.form("newname3")
newemail(3)=request.form("newemail3")
newname(4)=request.form("newname4")
newemail(4)=request.form("newemail4")
newname(5)=request.form("newname5")
newemail(5)=request.form("newemail5")
if isemail(senderemail) then
validaddress=false
for i=1 to 5
if newemail(i)<>"" then
if not isemail(newemail(i)) then
session("sendername")=sendername
session("senderemail")=senderemail
session("newname(1)")=newname(1)
session("newemail(1)")=newemail(1)
session("newname(2)")=newname(2)
session("newemail(2)")=newemail(2)
session("newname(3)")=newname(3)
session("newemail(3)")=newemail(3)
session("newname(4)")=newname(4)
session("newemail(4)")=newemail(4)
session("newname(5)")=newname(5)
session("newemail(5)")=newemail(5)
session("message")=message
redir="referral.asp?err=" & i
response.redirect(redir)
else
validaddress=true
end if
end if
next
if not validaddress then
session("sendername")=sendername
session("senderemail")=senderemail
session("newname(1)")=newname(1)
session("newemail(1)")=newemail(1)
session("newname(2)")=newname(2)
session("newemail(2)")=newemail(2)
session("newname(3)")=newname(3)
session("newemail(3)")=newemail(3)
session("newname(4)")=newname(4)
session("newemail(4)")=newemail(4)
session("newname(5)")=newname(5)
session("newemail(5)")=newemail(5)
session("message")=message
response.redirect("referral.asp?err=7")
end if
for i=1 to 5
if newemail(i)<>"" then
Set objJMail = Server.CreateObject("JMail.SMTPMail")
objJMail.ContentType = "text/plain"
objJMail.Sender = senderemail
objJMail.SenderName= sendername
objJMail.AddRecipient(newemail(i))
objJMail.AddRecipient(siteadmin)
objJMail.Priority = 3
objJMail.Subject = "Recommended Site from " & senderemail & " to " & newname(i)'newemail(i)
objJMail.Body = sendername & " thinks that you should check out " & recsite & ". " & vbcrlf & sendername & " found it to be a great website " & vbcrlf & "."
objJMail.Execute()
objJMail.Close()
Set objJMail = Nothing
end if
next
else
session("sendername")=sendername
session("senderemail")=senderemail
session("newname(1)")=newname(1)
session("newemail(1)")=newemail(1)
session("newname(2)")=newname(2)
session("newemail(2)")=newemail(2)
session("newname(3)")=newname(3)
session("newemail(3)")=newemail(3)
session("newname(4)")=newname(4)
session("newemail(4)")=newemail(4)
session("newname(5)")=newname(5)
session("newemail(5)")=newemail(5)
session("message")=message
response.redirect("referral.asp?err=6")
end if
function isemail(what)
Set regex = New RegExp
regex.pattern="^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"
isemail=regex.test(what)
set regex=nothing
end function
%>
</body>
</html> |
This also checks the email adress via server side. Using JavaScript as well - well if users have JS turned off, it will not work. It all depends on how you want it to work |
|
Superpetauction

Joined: 07 Oct 2005 Posts: 47 Location: Logansport, Indiana
|
Posted: Tue Oct 18, 2005 11:43 am Re.. |
|
|
|
I agree. I use a Perl program on my auction site. I try and keep in mind that most people may not understand large scripts, and try and provide the least complicated and most understandable as possable. i know when i first started i was like lol . I will say Cory you seem to know what you are talking about  |
|
zylstra Site Admin

Joined: 10 May 2004 Posts: 125
|
Posted: Tue Oct 18, 2005 1:52 pm |
|
|
|
You both sound like you know what you are talking about, but don't you agree that my HTML code:
1) does not use Javascript client side resources.
2) is ultra simple.
3) does not allow spiders to harvest email addresses (because there are none).
4) doesn't even use server side resources.
5) is what RoverWrap asked for.
Do you guys agree or am I missing something? |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8271 Location: Castle Rock CO USA
|
Posted: Tue Oct 18, 2005 1:55 pm |
|
|
|
| Yes I agree - it does still rely on the user's email client to actually send it out. If the user does not have an email client (unlikely but could be at a public library and found my site - thinks it is great and wants to email it). I have just learned not to try to rely on others inasmuch as the code. |
|
Superpetauction

Joined: 07 Oct 2005 Posts: 47 Location: Logansport, Indiana
|
Posted: Tue Oct 18, 2005 4:02 pm Re.. |
|
|
|
I agree Cory.  |
|
yce
Joined: 12 Feb 2008 Posts: 7
|
Posted: Tue Feb 12, 2008 3:53 pm I would like to use Corey's code |
|
|
|
having trouble.... Could someone help me?
Thank you....
Russell |
|
yce
Joined: 12 Feb 2008 Posts: 7
|
Posted: Tue Feb 12, 2008 3:54 pm This essentially what i get after posting from the code? |
|
|
|
Email address for is not valid. Please retry !
Email address for is not valid. Please retry !
Email address for is not valid. Please retry !
Email address for is not valid. Please retry !
Email address for is not valid. Please retry !
Please enter your email!
Please enter at least one email address !
Do you like our site? Tell a friend!
Name email
You:
Friend:
Friend:
Friend:
Friend:
Friend:
Your
Message: <%=user_message%> |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8271 Location: Castle Rock CO USA
|
|
yce
Joined: 12 Feb 2008 Posts: 7
|
Posted: Wed Feb 13, 2008 11:20 am I am very new to this... working hard on it though.. |
|
|
|
I need to ask a couple of questions first?
When you say valid email? Do i have to set up an email account with my "server company".
Yes, they do support JMAIL and ASP. mydomain.com is the name of the server.....
Also Corey, you have two codes... I understand to place the 1st code on my webpage....
I have no idea what to do with the 2nd. long code which you have written...
p.s. i do understand why the invalid email lines come up when i preview the page... I did not plug in the email required.....
Which takes me back in the circle..... funny stuff i tell ya. |
|
|