Distinct offers Network Monitor, the ONLY natural language Protocol Analyzer, ONC RPC for C++, .NET and Java, and IntelliTerm, the fastest Terminal Emulator for TN3270, TN5250 and VT420 on the market.

Distinct VIT: MIME Control: Action

   Products   Downloads   Sales   Support   About us
  VIT



        
 

Summary

Create, extract, encode or decode messages.

Description

The Action property controls the state of the MIME ActiveX control. A file can be encoded or decoded by assigning one of the following values to this property. A message can be created or extracted using this property but these values have been deprecated, and the CreateMessage, ExtractMessageStart, ExtractMessageData and ExtractMessageEnd methods should be used instead

Value Meaning
ACTION_ABORT Abort create message.
ACTION_UUENCODE Encode using Uuencode format.
ACTION_UUDECODE Decode using Uudecode format.
ACTION_BASE64_ENCODE Encode using Base64 format.
ACTION_BASE64_DECODE Decode using Base64 format.
ACTION_QUOTED_ENCODE Encode using Quoted-Printable format.
ACTION_QUOTED_DECODE Decode using Quoted-Printable format.
ACTION_BINHEX_ENCODE Encode using BinHex format.
ACTION_BINHEX_DECODE Decode using BinHex format.
ACTION_CREATE Create message. This Value has been deprecated.
ACTION_CREATE_X Create message and upcall with data. This value has been deprecated
ACTION_EXTRACT Extract message. This value has been deprecated

This property can be changed at run time only.

Before setting the Action property to ACTION_CREATE, the following properties must be initialized. The To property must be set to the mailing address (mail message) or the news group names (news article) of the recipients. The From property must be set to the mailing address of the sender. The Subject, Cc and Bcc properties are optional parameters and can be left as empty strings. The IsMime and IsNews property must be set correctly. Plain messages can be plain text or uuencoded. MIME messages can be base64 encoded, quoted-printable encoded or plain text. The encoding is done by the MIME ActiveX control. For MIME messages, apart from the above the ContentId, ContentType, Subtype and Charset (optional) have to be set before creating the message. The MessageType property must be set for partial or external MIME messages. The Destination property must be set to the destination file name. The OnInformation, OnHeader and OnBody events will be fired to obtain the message header and body as well as any attachments. Once the header and body of the message is composed, the OnStatistics event is fired with the number of lines and number of bytes in the header and body of the message. For partial messages, the OnPartial event will be fired to obtain the part number and id and for external messages, the OnExternal event will be fired to obtain the access type and other pertaining information. Please check the reference page of the individual properties for more information.

An application that cannot handle file i/o should use the ACTION_CREATE_X action to create the message. All the other properties except the destination filename needed for ACTION_CREATE must be initialized before setting the action. It is similar to ACTION_CREATE action, only at the end the OnData event will be fired one or more times to deliver the created message to the application

To abort the create or extract message, set the Action property to ACTION_ABORT during the OnInformation, OnHeader, OnBody, OnStatistics, OnSetHeader, OnSetBody, OnSetBodyB, OnRecvAddrField, OnRecvHeader, OnRecvBody or OnRecvBodyB events. The action in progress will be canceled and no further such events will occur.

To extract a message, set the Action property to ACTION_EXTRACT with the Source and Destination properties set to the source file and the destination directory. The message header and body are extracted first and saved in the destination directory. The OnExtract event will be fired to inform the application about the filename, encoding type, content type, subtype and level. The FileName, Encoding, ContentType and Subtype properties will be set with the appropriate values before the OnExtract event is fired. If there are any attachments, they will be extracted and the OnExtract event will contain the information. All encoded files will be decoded and then saved. For Partial messages, the OnExtract message will be fired only when all the parts of the message have been extracted and reassembled.

To UUencode a file, set the Action property to ACTION_UUENCODE with the Source and Destination properties set. The FileName property must be set to the name that will be used during encoding. This is necessary to preserve the original name of the file during the decoding process at the receiving end. The number of lines in the encoded file is returned in the Lines property after the encoding. If the Destination property is an empty string, then the encoded output is not generated but the Lines property will contain the number of lines in the encoded file. This information is necessary while building the header for a uuencoded message.

To UUdecode a file, set the Action property to ACTION_UUDECODE with the Source and Destination properties set. Once the file has been decoded, the FileName property will contain the name of the original file used during the UUencode process. The application may want to rename the decoded file to its original name.

MIME messages have three encoding formats: Base64, BinHex and Quoted-printable. The Base64 encoding format is widely used. The quoted-printable encoding is used when the file is mostly ASCII characters but also contains special characters or very long lines. The BinHex encoding is a popular means of encoding Macintosh files for transmission via internet mail. The Source and Destination properties must be set for these encoding and decoding formats. For BinHex encoding and decoding the BinHexCreator, BinHexResource, BinHexType and BinHexFlag properties are also used.

To encode using base64 format, set Action property to ACTION_BASE64_ENCODE and to decode a base64 encoded file, set the Action property to ACTION_BASE64_DECODE. To encode using quoted-printable format, set Action property to ACTION_QUOTED_ENCODE and to decode a quoted-printable encoded file, set the Action property to ACTION_QUOTED_DECODE.

To encode using BinHex format, set Action property to ACTION_BINHEX_ENCODE and to decode a BinHex encoded file, set the Action property to ACTION_BINHEX_DECODE. Before setting the Action property the following properties must be set: Destination, Source and Filename. The BinHexCreator, BinHexFlag, BinHexResource and BinHexType may be set by the application before encoding or the default values of these properties will be used. These properties will be set by the MIME ActiveX control after the file has been decoded

If an error occurs, then the OnError event will be fired. The application should set a flag in the OnError event, so that it can determine if the action was successful. In addition, the application may want to display an error message in the OnError event to inform the user of the error. Please check the reference page of the OnError event for a complete listing of error codes.

The Abort, Create, CreateX, Extract, UUencode, UUdecode, Base64Encode, Base64Decode, QuotedEncode, QuotedDecode, BinHexEncode and BinHexDecode methods accomplish the same as the above actions. The Create, CreateX and Extract methods have been deprecated, and the CreateMessage, ExtractMessageStart, ExtractMessageData and ExtractMessageEnd methods should be used instead. Please check the reference pages of these methods for more detailed information on their usage.

There is no default value for the Action property.

Example

Mime.Destination = "c:\temp\test.msg"
Mime.Source = "c:\temp\testfile.txt"
Mime.Action = ACTION_BASE64_ENCODE



Browse FAQ

Related Products
Mail Objects

Recommended Add-On
Network Monitor,
Protocol Analyzer


Raves
"The night before I went on summer holiday we had to make some 'last minute' configuration changes to approx. 300 routers, a tedious job to do manually with telnet. We went along with MS Excel containing a list of IP-adresses to the routers, and the VIT telnet-component. One hour later the VBA-application (small is beautiful) was working, and after another hour all of our routers were updated with the new configuration. I just say a big "Thanks" to you all for a good sleep that night."
Eirik Brendholen, Ergo Integration AS

"We conducted a test session to compare the performance of similar products, and Distinct's product was better!" [more]
Dr. Shyam Sunder, Carnegie Mellon University

"Together with Distinct, we were able to offer our users an ideal soution to enabling them to connect to Yahoo! Pager, and to do so both quickly and reliably." [more]
Brian Park,
Producer of Yahoo! Pager, Yahoo! Inc.


  8/20/2008   Legal notices | PRIVACY Policy | Networking News |