473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

"Send to Friend" question

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
3 3318
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kurda Yon | last post by:
Sorry for a very stupid question. Can you tell me what does the following html source does if I press button "Send"? If I read this code by Netscaspe from my local file system and then press...
2
by: Shea Martin | last post by:
I am trying to use a system call which takes a function ptr. My compiler won't compile the code if I give the system_call a ptr to a class member function, A::func(). To combat this, I created an...
43
by: Zeng | last post by:
It's so messy w/o the "friend" relationship. Does anyone know why it was not supported in C#. It's almost about as bad as it doesn't support the inheritance hierarchy and method reference...
1
by: timbobd | last post by:
I have encountered a situation that I don't understand. When I call a sub of Friend scope (in an object with Friend scope), I am getting an error "Public member 'subname' not found in type...
2
by: Vark | last post by:
Interesting behavior I came across today where a child form has full access to a base form class' controls, but you can only modify the controls' properties in code, not in the visual designer....
0
by: AndyB | last post by:
I'm using xsd.exe to generate a typed-dataset. Then using typed dataset tables (datatables containing two columns--a name and a value) to bind to ASP.NET dropdown list controls (for the dropdown...
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
3
by: shybe | last post by:
Ok, Im trying to create a "send this article to a friend" script for my blog, Right now its sending all the articles, but I want it to only send the article in which the form is attached...
1
by: sj7272 | last post by:
Hi, I am building email marketing framework, my email templates go out to clients and I wish to include a "send to a friend" or "forward to a friend" link in the outbound email. I want to track...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.