BP_Email::set_headers( string[] $headers )

Set email headers.


Description Description

Does NOT let you override to/from, etc. Use the methods provided to set those.


Top ↑

Parameters Parameters

$headers

(string[]) (Required) Key/value pairs of header name/values (strings).


Top ↑

Return Return

(BP_Email)


Source Source

File: bp-core/classes/class-bp-email.php

	public function set_headers( array $headers ) {
		$new_headers = array();

		foreach ( $headers as $name => $content ) {
			$content = str_replace( ':', '', $content );
			$name    = str_replace( ':', '', $name );

			$new_headers[ sanitize_key( $name ) ] = sanitize_text_field( $content );
		}

		/**
		 * Filters the new value of the email's "headers" property.
		 *
		 * @since 2.5.0
		 *
		 * @param string[] $new_headers Key/value pairs of new header name/values (strings).
		 * @param BP_Email $this Current instance of the email type class.
		 */
		$this->headers = apply_filters( 'bp_email_set_headers', $new_headers, $this );

		return $this;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.