By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

"Send to Friend" question

P: n/a
I've created a link that will enable the reader of any page on my
website to click it, enter an e-mail address, and have it arrive in
that inbox with a hyperlink to the site. However, I'm wondering if
there's a way to customize it further, such that the hyperlink they
are sent is the web address of the page the "send to friend" link was
on. I don't want to convert my entire site over to .asp, so having a
pop-up .asp page seems to make sense, but I want to make sure I can
achieve the functionality I seek. Thanks.

At present, here's the coding (currently configured to send the URL of
the page the code is on, not the URL of the page I want it to):

<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail-fwd"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = fromWho & "has sent you " &
Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("PATH_INFO")
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body

Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.redirect ""
END IF
%>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
Your Friend's<br>
E-mail:<br>
<INPUT NAME="toWho" TYPE="text" SIZE=10>
<BR>Your E-mail:
<INPUT NAME="fromWho" TYPE="text" SIZE=10>
<BR>
<INPUT NAME="Subject" TYPE="hidden" value="A Feline
Friend Found this for You!" SIZE=40>
<BR><INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>

E
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 12 Mar 2004 10:42:49 -0800, er**********@hotmail.com (Erik T.
Nomad) wrote:
I've created a link that will enable the reader of any page on my
website to click it, enter an e-mail address, and have it arrive in
that inbox with a hyperlink to the site. However, I'm wondering if
there's a way to customize it further, such that the hyperlink they
are sent is the web address of the page the "send to friend" link was
on.
Sure.
I don't want to convert my entire site over to .asp, so having a
pop-up .asp page seems to make sense, but I want to make sure I can
achieve the functionality I seek. Thanks. At present, here's the coding (currently configured to send the URL of
the page the code is on, not the URL of the page I want it to):
Simply call this sub and pass it the URL of the page, let it use that
in the link. Something like:

Link on page to send (watch for wrap, one line):

<A
HREF="http://www.sample.com/emailscript.asp?LinkURL=http://www.sample.com/thispage.htm">Send
this to a friend</A>

Modify this as:
<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail-fwd"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB
LinkURL = Request.QueryString(LinkUrl)
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = fromWho & "has sent you " &
Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("PATH_INFO")
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body

Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.redirect ""
END IF
%>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
Your Friend's<br>
E-mail:<br>
<INPUT NAME="toWho" TYPE="text" SIZE=10>
<BR>Your E-mail:
<INPUT NAME="fromWho" TYPE="text" SIZE=10>
<BR>
<INPUT NAME="Subject" TYPE="hidden" value="A Feline
Friend Found this for You!" SIZE=40>
<INPUT NAME="LinkURL" TYPE = "hidden" value = <% =LinkURL %> >
<BR><INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>

E


Jul 19 '05 #2

P: n/a
If you want the same code in all pages, you can use client-side code to
determine the url to pass in the querystring. I don't know what your method
of choice is for calling a javascript function, so I'll put it as the href
of a link.

<a href="javascript:mailMe()">Send me</a>
<script type="text/javascript">
function mailMe() { location.href='/sendpage.asp?link='+location.href; }
</script>

Ray at work
"Jeff Cochran" <jc*************@naplesgov.com> wrote in message
news:40*****************@msnews.microsoft.com...
On 12 Mar 2004 10:42:49 -0800, er**********@hotmail.com (Erik T.
Nomad) wrote:
I've created a link that will enable the reader of any page on my
website to click it, enter an e-mail address, and have it arrive in
that inbox with a hyperlink to the site. However, I'm wondering if
there's a way to customize it further, such that the hyperlink they
are sent is the web address of the page the "send to friend" link was
on.
Sure.
I don't want to convert my entire site over to .asp, so having a
pop-up .asp page seems to make sense, but I want to make sure I can
achieve the functionality I seek. Thanks.

At present, here's the coding (currently configured to send the URL of
the page the code is on, not the URL of the page I want it to):


Simply call this sub and pass it the URL of the page, let it use that
in the link. Something like:

Link on page to send (watch for wrap, one line):

<A

HREF="http://www.sample.com/emailscript.asp?LinkURL=http://www.sample.com/th
ispage.htm">Send this to a friend</A>

Modify this as:
<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail-fwd"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB


LinkURL = Request.QueryString(LinkUrl)
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = fromWho & "has sent you " &
Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("PATH_INFO")
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body

Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.redirect ""
END IF
%>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
Your Friend's<br>
E-mail:<br>
<INPUT NAME="toWho" TYPE="text" SIZE=10>
<BR>Your E-mail:
<INPUT NAME="fromWho" TYPE="text" SIZE=10>
<BR>
<INPUT NAME="Subject" TYPE="hidden" value="A Feline
Friend Found this for You!" SIZE=40>


<INPUT NAME="LinkURL" TYPE = "hidden" value = <% =LinkURL %> >
<BR><INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>

E

Jul 19 '05 #3

P: n/a
Thanks to both of you! Got it to work!

E

"Erik T. Nomad" <er**********@hotmail.com> wrote in message
news:f4**************************@posting.google.c om...
I've created a link that will enable the reader of any page on my
website to click it, enter an e-mail address, and have it arrive in
that inbox with a hyperlink to the site. However, I'm wondering if
there's a way to customize it further, such that the hyperlink they
are sent is the web address of the page the "send to friend" link was
on. I don't want to convert my entire site over to .asp, so having a
pop-up .asp page seems to make sense, but I want to make sure I can
achieve the functionality I seek. Thanks.

At present, here's the coding (currently configured to send the URL of
the page the code is on, not the URL of the page I want it to):

<%
SUB sendmail( fromWho, toWho, Subject, Body )
Dim objCDO
Dim iConf
Dim Flds

Const cdoSendUsingPort = 2

Set objCDO = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")

Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail-fwd"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With

Set objCDO.Configuration = iConf

objCDO.From = fromWho
objCDO.To = toWho
objCDO.Subject = Subject
objCDO.TextBody = Body
objCDO.Send

END SUB
fromWho = TRIM( Request.Form( "fromWho") )
toWho = TRIM( Request.Form( "toWho") )
Subject = TRIM( Request.Form( "Subject" ) )
Body = fromWho & "has sent you " &
Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("PATH_INFO")
If toWho <> "" THEN
sendMail fromWho, toWho, Subject, Body

Set ObjCDO = Nothing
Set iConf = Nothing
Set Flds = Nothing
Response.redirect ""
END IF
%>
<FORM METHOD="POST" ACTION="<%=Request.ServerVariables("SCRIPT_NAME")% >">
Your Friend's<br>
E-mail:<br>
<INPUT NAME="toWho" TYPE="text" SIZE=10>
<BR>Your E-mail:
<INPUT NAME="fromWho" TYPE="text" SIZE=10>
<BR>
<INPUT NAME="Subject" TYPE="hidden" value="A Feline
Friend Found this for You!" SIZE=40>
<BR><INPUT TYPE="SUBMIT" VALUE="Send Mail">
</FORM>

E

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.