472,958 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 3294
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.