wpcf7_phpmailer_init()
Adds custom properties to the PHPMailer object.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wpcf7_phpmailer_init( $phpmailer );
- $phpmailer(обязательный)
- .
Код wpcf7_phpmailer_init() wpcf7 phpmailer init CF7 6.1.6
function wpcf7_phpmailer_init( $phpmailer ) {
$custom_headers = $phpmailer->getCustomHeaders();
$phpmailer->clearCustomHeaders();
$wpcf7_content_type = false;
foreach ( (array) $custom_headers as $custom_header ) {
$name = $custom_header[0];
$value = $custom_header[1];
if ( 'X-WPCF7-Content-Type' === $name ) {
$wpcf7_content_type = trim( $value );
} else {
$phpmailer->addCustomHeader( $name, $value );
}
}
if ( 'text/html' === $wpcf7_content_type ) {
$phpmailer->msgHTML( $phpmailer->Body );
} elseif ( 'text/plain' === $wpcf7_content_type ) {
$phpmailer->AltBody = '';
}
}