%@ Language=VBScript %>
<%'this page is displayed after a form is submitted on erb.asp and an email is sent
dim strTitle
strTitle="ERB Form - Submitted"
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<%
Dim uploadsDirVar
uploadsDirVar = "e:\Intranet Files\ERB_Temp"
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "File uploaded: "
for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
next
Dim EmailBody
EmailBody = "
"
EmailBody = EmailBody & " Thanks! "
if upload.form("Message")<>"" then
EmailBody = EmailBody & "Message: " & upload.form("Message") & " "
end if
' SEND EMAIL USING CDONTS
On Error Resume Next
Set Mailer = CreateObject("CDONTS.NewMail")
Mailer.From = "hr@company.com"
Mailer.To = "hr@company.com"
Mailer.Cc = ""
Mailer.Subject = " ERB Form Recieved"
Mailer.MailFormat = 0 'MIME
Mailer.BodyFormat = 0 'html
Mailer.Body = EmailBody
Dim AttachedFile
AttachedFile = uploadsDirVar & "\" & UploadedFiles.FileName
'Response.Write "AttachedFile: " & AttachedFile
Mailer.AddAttachment = AttachedFile
Mailer.Send
If Err.Number <> 0 Then
Response.Write "THERE WAS AN ERROR WITH THE CHANGE REQUEST. PLEASE SEE HR
" & "Error: " & Err.Number & " - " & err.description
End If
if Err.Number > 0 or not err.description = "" Then
Response.Write "error num: " & Err.Number & " desc: " & err.description
End If
set Mailer = nothing
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
end function
%>
Employee Referral Program
Employee Referral Program - Submitted...
<%If Err.Number = 0 then %>
Thank You!
<% else %>
There was an error:
<%Err.Number%><%err.description%>
. Your request has not been submitted. Please contact HR.
<%end if %>
Here is the information that you entered:
<% Del=Len("
Employee Referral Program.
")
Rest=Len(EmailBody) - Del
response.write Right(EmailBody, 500)
%>
<% ' upload file part
Response.Write SaveFiles()
%>