|
See the section entitled "Using Distinct ActiveX controls in various
environments" on how to add the control to your project.
The MIME ActiveX control can be used to create a mail message or news article. The
created file can then be sent using the SMTP (for mail messages) ActiveX control. If the
POP2/POP3 ActiveX control is used to retrieve a mail message, the application can save the
mail message to a file and use the MIME ActiveX control to extract the message. Similarly,
for news articles, the MIME ActiveX control can be used to create a news article which can
be posted using the NNTP ActiveX control.
After placing a MIME ActiveX control into a form, most properties can be set at design
time. However, the application may want to request information from the user at runtime
before setting the properties. The Source and Destination properties must be set before
setting the Action property to perform actions such as creating, extracting, encoding or
decoding messages. The Source property must be set to the complete path and filename of
the source file. The Source property is not used for create message. The Destination
property must be set to the destination filename or directory. For extract message, the
Destination property must be a directory name. The Action property can only be accessed at
run time.
To create a message the CreateMessage method should be called. If the application is
creating a MIME message, in CreateMessage the IsMime parameter must be set to True;
otherwise it must be set to False (in which case it would be a plain message). Also, the
IsNews parameter must be set to True for a news article and to False for a mail message.
The Destination parameter should specify the destination file name for the created
message, if this is set to NULL then the OnData event will be fired to deliver the entire
message (If the control wants to receive the message as binary data it should set the
UseVariant property to True before calling CreateMessage and the OnDataB event will be
fired to notify the application that the DataB method can be called to obtain the binary
data from the control).
The OnSetAddrField event will be fired first to get the message address fields, the
"To" and "From" fields must be set using this event.The OnSetHeader
and OnSetBody events will then be fired to obtain the header and body of the message, as
well as any attachments. The data in the body of the message or attachments can be binary
by setting the UseVariant property to True. The OnSetBodyB event will be fired to notify
the application that the SetBodyB method can be called to pass binary data to the control.
If an error occurs during the create process, an OnError event will be fired. The
application can abort the creation of the message at any time by setting the Action
property to ACTION_ABORT or by calling the Abort method.
To extract a message the ExtractMesageStart method should be called with Destination
parameter set to the destination directory for the extracted files. If the Destination is
set to NULL then the extracted parts of the message will be delivered to the application
in one or more OnRecvBody events, otherwise the files will be saved to the destination
directory and the OnRecvBody events will deliver the names of the extracted files. To
receive the message parts as binary data set the UseVariant property to True before
calling ExtractMessageStart and the OnRecvBodyB events will be fired, and the RecvBodyB
method can be called to receive binary data.
After the ExtractMessageStart method has been called the application must call the
ExtractMessageData method with the contents, or filename of the message to be extracted,
and the IsFile parameter set respectively. When all the data has been passed to the MIME
ActiveX control the ExtractMessageEnd method should be called. The message address,
header, body and any attachments will extracted (and decoded if necessary) and delivered
in to the application in OnRecvAddrField, OnRecvHeader, and OnRecvBody (or OnRecvBodyB)
events.
Apart from creating and extracting messages, the MIME ActiveX control can be used to
encode or decode files using the Base64, BinHex or Quoted-Printable formats. UUencode and
UUdecode is also supported.
The functions Create, CreateX, Extract and ExtractX have been deprecated, and are
documented only for backward compatibility. The CreateMessage method should to create a
message and the ExtractMessageStart, ExtractMessageData and ExtractMessageEnd methods
should be used to extract a message.
|