|
Summary
Sets the address field for a message.
Description
Before a message can be created the To, From, Cc, Bcc and Subject fields need to be
set. Each of these fields can be encoded differently. This event allows the appliation to
specify the value and the encoding type of each field. This event must be used once for
each of the To and From fields. The Cc, Bcc and Subject fields are optional.
The Field parameter must contain "To", "From",
"Cc", "Bcc" or "Subject". The Value field should
contain the value of the respective header fields, the Charset field may specify
the character set of the respective fields, and this field will be ignored if the Value
field doesn't need to be encoded. If the Value field needs to be encoded then the Encoding
parameter should contain either ADDR_BASE64_ENCODED or ADDR_QUOTED_ENCODED, if
encoding is not necessary the Encoding parameter should contain ADDR_NO_ENCODING.
If the application wants to use more than one type of encoding for a field then it may
call this method multiple times with the same field but the different values and
corresponding encoding for that value.
If the Field it set to "To" then the Value parameter must be set to
the mailing address (mail message) or the news group names (news article) of the
recipients. If the Field parameter is set to "From" then the Value
parameter must be set to the mailing address of the sender.
In some environments, such as Visual J++, the new value assigned to the Field,
Value, Charset and Encoding parameters can not be successfully retrieved by the
control. In these cases set UseProperty to True, and assign the parameter values to the
AddrField, FieldValue, FieldCharset and FieldEncoding respectively. In this case the
UseProperty property must be set to True before attempting to create a message, and treat
the properties exactly as you would the respecitive parameters.
The actual internet address in the "To" can not be encoded, otherwise the
message will be undeliverable. Other parts of the "To" field may be encoded, see
the example below.
Example
Sub Mime_OnSetAddrField (Field As String, Value As
String, Charset As String, Encoding As Integer)
If (bTo) Then
Field = "To"
Value = "santa@northpole.com"
Charset = ""
Encoding = ADDR_NO_ENCODING 'Can not encode email address
bTo = False
Else if (bTo2) Then
Field = "To"
Value = "<santa claus>"
Charset = "us-ascii"
Encoding = ADDR_BASE64_ENCODED
bTo2 = False
Else if (bFrom) Then
Field = "From"
Value = "elf@warehouse.com"
Charset = ""
Encoding = ADDR_NO_ENCODING
bFrom = False
Else
Field = ""
End If
End Sub
|