PostArticle (Dundas Mailer Control 1.0)
Overview | Properties | Methods
Call this method to post an article to a newsgroup. You can post to either the root of the article listing or beneath an existing article.
Syntax
MailerObject.PostArticle(Server as string, [Group as string = "", UserName as string = "", Password as string = "", Port as long = 119])
The PostArticle method syntax has the following parts:
Part |
Description |
Server |
The name of the server to post the article to (e.g. msnews.microsoft.com), or its corresponding IP address. |
Group |
The name of the news group to post the article to. Defaults to a zero-length string. |
UserName |
Username of the news group account (usually not required by newsgroups). Defaults to a zero-length string. |
Password |
Password of the news group account (usually not required by newsgroups). Defaults to a zero-length string. |
Port |
The port to be used when posting the article. Defaults to port 119. |
Remarks
An exception is thrown if an error occurs. Trap for the success/failure of the operation by examining VBScript's Err object immediately after calling this method (the Number property of the Err object will be a non-zero value if an error occurred). MAKE SURE that you have enabled inline error trapping by using an On Error Resume Next statement at the beginning of the ASP page.
The material to be posted is determined by the Body property (you can alternatively use the HtmlBody property but not all news servers support html-based articles). PostArticle uses all properties of the Mailer control except for the ones listed below:
Priority
ReturnReceipt
ConfirmRead
TOs collection
CCs collection
BCCs collection
DNSServers collection, and
- SMTPRelayServers collection
You MUST specify the name of the server the article is to be posted to. You can then set the Group argument to the name of the news group to post to or alternatively you can leave this as a zero-length string and then add the "Group" custom header to the CustomHeaders collection. Set the value of this custom header to the name of the news group to post to.
If there are no items in the ReplyTOs collection then the FromAddress property determines the address to be used for replies. You will also HAVE TO set the Body property before sending the article. If you try to post an "empty" article a trappable error will occur.
You can post to more than one group by specifying multiple news groups for the Group argument and then separating the multiple entries with commas. If you are using the CustomHeaders collection to specify the news groups then just add the names of the desired news groups to this collection.
You also have the option of posting either to the root of the news article listing (the default) or you can post your article so that it appears below an existing article. To have your article appear as a node of an existing article you have to know the MessageID of the desired "root" article. If you know the MessageID you can add a custom header named "References" to the CustomHeaders collection. Set this custom header to the MessageID of the desired "root" article. When the PostArticle method executes it looks in the CustomHeaders collection for the "References:" header and if this header exists the article is posted beneath the article specified by the MessageID.
The UserName and Password arguments are only required if the newsgroup you belong to requires authentication (which is usually not the case).
To use an optional parameter without specifying any values for previous optional parameters just enter consecutive commas for the missing arguments. For example, "PostArticle("someserver.com",,,,323)" is a valid function call.
For example source code illustrating how to post a news atricle see Tutorial 3: Posting to a Newsgroup .
See Also: CustomHeaders Collection | Add Method (CustomHeaders collection)