<%@ Language=VBScript %> <% Response.Buffer = True 'enable buffering so we can use a redirect anywhere in the asp page '********************************************************************************* 'Copyright Dundas Software Ltd. 2000. All Rights Reserved. ' 'PURPOSE: Processes the information POSTED by PostArticle.asp, and then ' attempts to post the article to the specified news group. ' 'CONTROLS USED: Dundas Mailer control. ' 'COMMENTS: Form values are sent back to the main page using a Querystring. ' 'Dundas Software Contact Information: ' Email: sales@dundas.com ' Phone: (800) 463-1492 ' (416) 467-5100 ' Fax: (416) 422-4801 '********************************************************************************* Dim objEmail 'Mailer object Dim strServer 'stores news server name Dim strNewsGroups 'stores news group(s) to post to 'Mailer control methods will throw exceptions upon failure so we need to enable inline error trapping On Error Resume Next 'create instance of Mailer control Set objEmail = Server.CreateObject("Dundas.Mailer") 'do some error trapping, make sure user has entered a news server, at least one news group and ' an email address as well as at least one character for the article body If Request("txtServer") = "" Then Response.Redirect "Error.asp?Error=" & server.URLEncode("You must specify a news server.") Else strServer = Request("txtServer") End If If Request("txtNewsGroups") = "" Then Response.Redirect "Error.asp?Error=" & server.URLEncode("You must specify a news group.") Else strNewsGroups = Request("txtNewsGroups") End If 'we MUST set the FromAddress property If Request("txtEmail") <> "" Then objEmail.FromAddress = Request("txtEmail") Else Response.Redirect "Error.asp?Error=" & server.URLEncode("You must enter your email address.") End If 'we MUST set the Body property If Request("txtArticle") <> "" Then objEmail.Body = Request("txtArticle") Else Response.Redirect "Error.asp?Error=" & server.URLEncode("You must enter some text for the article body.") End If 'set the Subject of the article objEmail.Subject = Request("txtSubject") 'if user wants to respond to a particular article then add a custom header named "References" to ' the CustomHeaders collection, setting this header to the ID of the article to respond to. If Request("txtID") <> "" Then objEmail.CustomHeaders.Add "References:",Request("txtID") End If 'now attempt to post the article objEmail.PostArticle strServer,strNewsGroups 'now trap for success/failure of the posting operation If Err.Number <> 0 Then 'PostArticle failed. Set objEmail = Nothing Response.Redirect "Error.asp?Error=" & server.URLEncode(Err.Description) Else 'success! Set objEmail = Nothing 'redirect back to main page, passing QueryString params storing the form's previous values Dim k Dim item(4) For k = 1 To 5 item(k - 1) = Request.Form(k) Next Response.Redirect "PostArticle.asp?Success=TRUE&Value1=" & server.URLEncode(item(0)) & "&Value2=" & server.URLEncode(item(1)) & "&Value3=" & server.URLEncode(item(2)) & "&Value4=" & server.URLEncode(item(3)) & "&Value5=" & server.URLEncode(item(4)) End If %>