PHPMailer\PHPMailer
PHPMailer::DKIM_Sign
Generate a DKIM signature.
Метод класса: PHPMailer{}
Хуков нет.
Возвращает
Строку. The DKIM signature value
Использование
$PHPMailer = new PHPMailer(); $PHPMailer->DKIM_Sign( $signHeader );
- $signHeader(строка) (обязательный)
- .
Код PHPMailer::DKIM_Sign() PHPMailer::DKIM Sign WP 6.8.3
public function DKIM_Sign($signHeader)
{
if (!defined('PKCS7_TEXT')) {
if ($this->exceptions) {
throw new Exception($this->lang('extension_missing') . 'openssl');
}
return '';
}
$privKeyStr = !empty($this->DKIM_private_string) ?
$this->DKIM_private_string :
file_get_contents($this->DKIM_private);
if ('' !== $this->DKIM_passphrase) {
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
} else {
$privKey = openssl_pkey_get_private($privKeyStr);
}
if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
if (\PHP_MAJOR_VERSION < 8) {
openssl_pkey_free($privKey);
}
return base64_encode($signature);
}
if (\PHP_MAJOR_VERSION < 8) {
openssl_pkey_free($privKey);
}
return '';
}