BOOL AddHeaders( |
|
LPCTSTR lpszHeaderList |
|
); |
The AddHeaders method adds one or more headers
to the specified message.
Parameters
- lpszHeaderList
- Points to a null-terminated string which specifies one or more
header values which should be set for the specified message. This
parameter cannot be NULL.
Return Value
If the method succeeds, the return value is non-zero. If the string
contains one or more invalid headers, the method returns a value of zero.
To get extended error information, call the GetLastError method.
Remarks
The AddHeaders method enables your application to set one or
more header values by providing a list of name/value pairs separated by
a colon. Multiple header values may be provided by separating them with
a newline character. This method is similar to calling the SetHeader
method for each value. When the list of header values is parsed,
extraneous whitespace is ignored; however, if the header list contains
invalid text (for example, a missing colon separating a header name from
its value) the method will fail and an error will be returned.
This method will only add or update header values in the main
header block for the message. It cannot be used to update header values
in a specific section of a multipart message. If you need to add or
change a header value in a specific part of the message, use the
SetHeader method.
When adding custom, application-specific header values you should
always prefix them with "X-" to avoid conflicting with standard
headers.
Example
LPCTSTR lpszHeaderList = _T("X-App-Sender: someuser@domain.tld\n") \
_T("X-App-Version: 1.5\n") \
_T("X-App-Mailer: AppMail (Win64)\n")
if (! pMessage->AddHeaders(lpszHeaderList))
{
return;
}
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: csmsgv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
EnumHeaders,
GetFirstHeader,
GetHeader,
GetNextHeader,
SetHeader
|