Simple Flash-email greeting application
This application allows the user to send a note with a pre-defined background to another user. The user will
receive an email, that when clicked on, will display the greeting with the background and the note. It is fully
functional, so try it out. It a simplified PageMaker experiment where the XML gets stored in a local XML file.
Click the image below to try it out...
Below is the code that sends out the message and stores it in an XML file with only one element.
vbscript code
<%
'Incoming variables from Flash form
response.buffer = -1
str_ID = request.form("ID")
str_msgdate = request.form("msgdate")
str_bgID = request.form("bgID")
str_recipient = request.form("to")
str_from = request.form("from")
str_subject = replace(request.form("subject"), chr(13), " ")
str_message = replace(request.form("message"), chr(13), " ")
str_title = replace(request.form("title"), chr(13), " ")
str_subject = CleanCharacters(str_subject)
str_message = CleanCharacters(str_message)
'---------------------------------------------------------------------
'replaces all special characters to avoid discrepancies in XML string
Function CleanCharacters(rawstring)
Dim aVals(2, 1)
Dim j
aVals(0, 0) = "<"
aVals(0, 1) = "<"
aVals(1, 0) = ">"
aVals(1, 1) = ">"
aVals(2, 0) = """"
aVals(2, 1) = "'"
For j = 0 To UBound(aVals, 1)
rawstring = Replace(rawstring, aVals(j, 0), aVals(j, 1))
Next
CleanCharacters = rawstring
End Function
'-----------------------------------------------------------------------
'This creates the text files with the variable
set fsobj=Server.CreateObject("Scripting.FileSystemObject")
set tfile=fsobj.CreateTextFile(
Server.MapPath("/sandbox/thankyou/textfiles/"&str_ID&".xml"))
tfile.WriteLine("<ROW ID="&chr(34)& str_ID &chr(34)&
" msgdate=" & chr(34) & str_msgdate& chr(34) &
" to=" &chr(34)& str_recipient &chr(34)&
" from=" &chr(34)& str_from &chr(34)&
" subject=" &chr(34)& str_subject &chr(34)&
" message=" &chr(34)& str_message &chr(34)&
" bgID=" & chr(34) & str_bgID & chr(34) &
" title=" &chr(34) & str_title & chr(34)& " />" )
tfile.close
set tfile=nothing
set fsobj=nothing
Set Mailer = Server.CreateObject("Persits.MailSender")
Mailer.FromName = str_from
Mailer.From = str_from
Mailer.Host = "mail.mailhost.com"
Mailer.AddAddress str_recipient, str_recipient
Mailer.Subject = str_subject
Mailer.Body = "You have received a message from " &
str_from &"."&VBCRLF&VBCRLF&
"http://www.miguelmoreno.net/sandbox/thankyou/thankyou_get.aspx?ID=" & str_ID
On Error Resume Next
Mailer.Send
If Err <> 0 Then
Response.Write "errorcheck=0&errdescription=Mail send failure.
Error was " & Err.Description
else
Response.Write "errorcheck=1"
End If
set Mailer = nothing
%>