Board index » Web Programming » Email this page to a friend
|
alphapoint05
|
|
alphapoint05
|
Email this page to a friend
Web Programming121
what is the code i must use to "email a webpage to a friend." Also, where can I find the icon to use for that? thanks for helping out this new kid on the block. I am using frontpage 2003. - |
| Jim
Registered User |
Fri Sep 24 16:37:44 CDT 2004
Re:Email this page to a friend
Assuming you have a Windows Web server, try the page
below. You'll have to change the FromAddr and MailServ values to those of your address and your mail server. <%option explicit%> <html> <head> <title>Mail Referring Web Page</title> </head> <body> <% Const FromAddr = "myself@example.com" Const MailServ = "smtp.example.com" Const cdoSchema = _ "schemas.microsoft.com/cdo/configuration/"">schemas.microsoft.com/cdo/configuration/" dim refpage dim address dim objMsg If "" & request("btnSub") = "" Then refpage = "" & request.servervariables("HTTP_REFERER") else refpage = trim("" & Request.Form("refpage")) address = trim("" & Request.Form("txtAddr")) If refpage = "" Then Response.Write "<p>Message not sent: " & _ "URL missing.</p>" & vbCrLf Elseif address = "" Then Response.Write "<p>Message not sent: " & _ "To Address missing.</p>" & vbCrLf Else Set objMsg = CreateObject("CDO.Message") objMsg.Subject = "Web page at: " & refpage objMsg.Sender = FromAddr objMsg.To = address objMsg.CreateMHTMLBody(refpage) objMsg.Configuration.Fields.Item( _ cdoSchema & "sendusing") = 2 objMsg.Configuration.Fields.Item( _ cdoSchema & "smtpserver") = MailServ objMsg.Configuration.Fields.Item( _ cdoSchema & "smtpserverport") = 25 objMsg.Configuration.Fields.Update objMsg.Send Response.Write "<p>Message sent.</p>" & vbCrLf End If End If %> <form method="POST"> <input type="hidden" name="refpage" value="<%=refpage%>"> <table border="0"> <tr> <td>Send page:</td> <td><%=refpage%></td> </tr> <tr> <td>To Address::</td> <td><input type="text" name="txtAddr" size="40" value="<%=address%>"></td> </tr> <tr> <td> </td> <td><input type="submit" value="Submit" name="btnSub"></td> </tr> </table> </form> </body> </html> If you saved this page as mailpage.asp, you would link to it as: <a href="mailpage.asp">Mail this page to a friend.</a> Also, keep in mind that some of the fancy stuff that works in a browser (like DHTML menus and forms) won't work in a mail program. For more info about the e-mail techniques in this page, browse: Mailing Form Data http://www.interlacken.com/winnt/tips/tipshow.aspx?tip" rel="nofollow" target="_blank">www.interlacken.com/winnt/tips/tipshow.aspx=46 Jim Buyens Microsoft FrontPage MVP www.interlacken.com">www.interlacken.com Author of: *---------------------------------------------------- |\--------------------------------------------------- || Microsoft Office FrontPage 2003 Inside Out ||--------------------------------------------------- || Web Database Development Step by Step .NET Edition || Microsoft FrontPage Version 2002 Inside Out || Faster Smarter Beginning Programming || (All from Microsoft Press) |/--------------------------------------------------- *---------------------------------------------------- Quote-----Original Message----- |
