HeaderCollectionExists Method |
Checks whether a header with the given name exists in the collection.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public bool Exists(
string name
)
Public Function Exists (
name As String
) As Boolean
Parameters
- name
- Type: SystemString
The name of the header.
Return Value
Type:
Booleantrue if the collection contains the header with the specified name; otherwise,
false.
Examples This sample creates the new message and adds a custom header if it does not yet exist.
using MailBee;
using MailBee.Mime;
MailMessage msg = new MailMessage();
if (!msg.Headers.Exists("X-MyHeader"))
{
msg.Headers.Add("X-MyHeader", "some value for the header", false);
}
Imports MailBee
Imports MailBee.Mime
Dim msg As New MailMessage
If (Not msg.Headers.Exists("X-MyHeader")) Then
msg.Headers.Add("X-MyHeader", "some value for the header", False)
End If
See Also