DomainKeysSign Method (MailMessage, String, String, Boolean, String, DomainKeysTypes)
Signs a mail message with DomainKeys and/or DKIM signatures.

Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public MailMessage Sign(
	MailMessage msg,
	string[] headersToSign,
	string privateKeyStr,
	bool isFilename,
	string selector,
	DomainKeysTypes dkTypes
)

Parameters

msg
Type: MailBee.MimeMailMessage
The mail message to be signed.
headersToSign
Type: SystemString
The array of the names of the headers to be included in the signature, or a null reference (Nothing in Visual Basic) if all the message headers should be included in the signature.
privateKeyStr
Type: SystemString
The contents or the filename of the DomainKeys/DKIM private key.
isFilename
Type: SystemBoolean
If true, privateKeyStr denotes the private key filename; otherwise, the contents.
selector
Type: SystemString
The prefix of the sub-domain serving DomainKeys/DKIM for the sender domain.
dkTypes
Type: MailBee.SecurityDomainKeysTypes
Specifies which signatures to create (classic DK, newer DKIM, or both).

Return Value

Type: MailMessage
The signed mail message.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionmsg or privateKeyStr or selector is a null reference (Nothing in Visual Basic) or the message to be signed does not include the header specifying the sender (Sender or From or X-Sender header) or headersToSign array (if not null) does not list the name of that header or the sender's e-mail address domain is empty.
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks
This overload of Sign(MailMessage, String, String, Boolean, String) allows you to select which methods to use (classic DK, newer DKIM, or both).
Note Note
Be sure to enable FipsMode if the current system is FIPS-compliant.
See Also