<% ' SendMail.inc. VBScript methods to retrieve information from a user and send mail ' '============================== 'Get message information and send ' ' Finds a server and mailbox name to use to login with. This sample returns ' a form to the user requesting the information. By replacing this subroutine, ' the data could come from anywhere else (a database, hardcoded, etc.) '============================== Sub GetMessageInfo(ByRef objAMSession) Dim objOutbox Dim objMessage Dim objRecipients Dim objRecipient Dim strLogonID Dim bstrMailbox Dim bstrServer Dim strRecipient Dim strSubject Dim strMessage On Error Resume Next strRecipient = Request.QueryString( "txtRecipient") If strRecipient = "" then Response.Write("You are currently logged into the mailbox for: " & objAMSession.CurrentUser & "
") Response.Write("Please fill in all fields for your message.
") Response.Write("") Response.Write("
") Response.Write("
") Response.Write(" ") Response.Write(" ") Response.Write(" ") Response.Write(" ") Response.Write(" ") Response.Write(" ") Response.Write("
Recipient:
Subject:
Message:
") Response.Write("

") Response.Write("
") ' nothing after the next line will be executed Response.End Else strSubject= Request.QueryString( "txtSubject") strMessage = Request.QueryString( "txtMessage") Set objOutbox = objAMSession.Outbox Set objMessage = objOutbox.Messages.Add Set objRecipients = objMessage.Recipients Set objRecipient = objRecipients.Add objRecipient.Name = Request.QueryString( "txtRecipient") err.clear objRecipient.Resolve if err.number= -2147221233 then response.write("Recipient not found,please use your back button to reload your page

") else objMessage.Subject = Request.QueryString( "txtSubject") objMessage.Text = Request.QueryString( "txtMessage") objMessage.Send Response.Write("The following message was sent
") Response.Write("Sender: " & objAMSession.CurrentUser & "
") Response.Write("Recipient: " & Request.QueryString("txtRecipient") & "
") Response.Write("Subject: " & Request.QueryString("txtSubject") & "
") Response.Write("Message: " & Request.QueryString("txtMessage") & "
") end if End If Set objRecipient = Nothing Set objMessage = Nothing Set objOutbox = Nothing End Sub %>