%@ Language=VBScript %>
<% Option Explicit
Response.Buffer = True 'enable buffering
'*************************************************************************
'Copyright Dundas Software Ltd. 2000. All Rights Reserved.
'
'PURPOSE: Sends an email to the specified recipient with a
' fictitious username and password. A success or
' failure message will be output upon completion of
' the operation.
'
'POST DESTINATION: Self-posting.
'
'INPUT: Email address, first name, last name and optional
' SMTP relay server.
'
'COMMENTS: Uses the QuickSend method to send the email.
' User will be redirected to the Error.asp page if the
' operation is unsuccessful.
'
'Dundas Software Contact Information:
' Email: sales@dundas.com
' Phone: (800) 463-1492
' (416) 467-5100
' Fax: (416) 422-4801
'*************************************************************************
%>
Dundas Mailer Control Demo: AutoResponse Message
<% If Request("txtEmail") = "" Then
'user has not entered any information yet
%>
Someone has forgotten his/her username and/or password for some sort of web
site account.
The user enters his/her email address and the fictitious account information is
then sent to the specified address.
- Uses the SMTPRelayServers collection
to specify SMTP servers.
- Uses the QuickSend method to send the email with
one line of code.
- Errors are trapped for by using raised exceptions.
<% Else
'user has entered required information. Send the email with fictitious
' account information and display a success or failure message.
'enable inline error trapping to trap for any exceptions raised by the Mailer control
On Error Resume Next
Dim objMail 'Mailer object
'create an instance of the control
Set objMail = server.CreateObject("Dundas.Mailer")
'set the smtp server name if the user has specified an SMTP server.
If Request("txtSMTP") <> "" Then
objMail.SMTPRelayServers.Add Request("txtSMTP")
End If
'set the user name and greeting string
Dim userName
If Request("txtFName") <> "" and Request("txtLName") <> "" Then
userName = "Hello " & Request("txtFName") & " " & Request("txtLName") & "."
ElseIf Request("txtFName") = "" and Request("txtLName") <> "" Then
userName = "Hello " & Request("txtLName") & "."
ElseIf Request("txtFName") <> "" and Request("txtLName") = "" Then
userName = "Hello " & Request("txtFName") & "."
Elseif Request("txtFName") = "" and Request("txtLName") = "" Then
userName = "Hello!"
End If
objMail.QuickSend "AnAdministrator@SomeDomainName.com", Request("txtEmail"), "Account information", vbCrLf & userName & vbCrLf & "Your username is UserName." & vbCrLF & "Your password is Password."
If Err.Number <> 0 Then
'see if mail send operation was unsuccessful, if so redirect to error page
Response.Redirect "Error.asp?Error=" & Err.Description
Else
'display success message
Response.Write "
The previous automatic response was successfully sent."
Response.Write "You can use your browser's Back button to try this again if you wish.
"
End If
'release resources
Set objMail = Nothing
End If
'send contents of html buffer to the browser
Response.End
%>