BP_Email::set_from( string|array|int|WP_User $email_address, string $name = '' )

Set the email’s “from” address and name.

Description

Parameters

$email_address

(string|array|int|WP_User) (Required) Either an email address, user ID, or WP_User object.

$name

(string) (Optional) If $email_address is a string, this is the recipient's name.

Default value: ''

Return

(BP_Email)

Source

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

	public function set_from( $email_address, $name = '' ) {
		$from = new BP_Email_Recipient( $email_address, $name );

		/**
		 * Filters the new value of the email's "from" property.
		 *
		 * @since BuddyPress 2.5.0
		 *
		 * @param BP_Email_Recipient $from Sender details.
		 * @param string|array|int|WP_User $email_address Either an email address, user ID, or WP_User object.
		 * @param string $name Optional. If $email_address is a string, this is the recipient's name.
		 * @param BP_Email $this Current instance of the email type class.
		 */
		$this->from = apply_filters( 'bp_email_set_from', $from, $email_address, $name, $this );

		return $this;
	}

Changelog

Changelog
Version Description
BuddyPress 2.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.