473,289 Members | 1,866 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,289 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 3316
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.