The MailSetField function is used to add, update, or delete fields from the message header.
BOOL MailSetField (MailMsg*pmm, LPWSTR szName, LPCWSTR szVal);
Header file: | Msgstore.h |
Platforms: | H/PC |
Versions: | 1.0 and later |
This function returns TRUE if successful; FALSE if it fails. For extended error information, use MailError or MailErrorMsg.
The MailSetField function searches the header (that is, the pwcHeaders field) of the MailMsg structure in memory. Before calling MailSetField, the message must be retrieved from the message store by calling MailGet, MailFirst, or MailNext.
The pwcHeaders member of the MailMsg structure points to the message's header string. The header consists of entries made up of two fields: a name, and an associated value. The name fields are separated from the value fields by a NULL character, and the entries are separated from each other by a NULL character. The header string is terminated with two consecutive NULL characters.
If a matching name field is not found in the message store, the entry is added to the header. If the entry name is found, the value field is changed to the new value passed in. If the value field being passed in is NULL and the entry name exists in the header, the entry is deleted.
For more information, see Inbox.