Skip to:

Opened 8 years ago

Closed 8 years ago

#7051 closed defect (bug) (worksforme)

BP_Email::set_from() seems to set recipient details, not sender details

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.0
Component: Emails Keywords:


We can set the from address and name like this: BP_Email::set_from( $email_address, $name );

The problem is the first line of BP_Email::set_from() instantiates an object of type BP_Email_Recipient and passes arguments to that class constructor.

To me, "set from" should set sender info, not recipient info.

Change History (4)

#1 @thebrandonallen
8 years ago

  • Keywords reporter-feedback added

While a little confusing, BP_Email::set_from() does indeed set the from name and from email to the sender info, even though it uses BP_Email_Recipient. BP_Email_Recipient is recipent/sender agnostic, so it works with the info you pass to it's constructor. It's built to handle multiple types of data. This is especially helpful when passing multiple recipients, hence the name, and then formatting/validating the data into reliable objects. In the case of the from name/email, it's essentially just validating the passed from name/email, and returning the appropriate object.

Are you seeing a different behavior?

#2 @r-a-y
8 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

The BP_Email::set_from() method does set the sender's info. @thebrandonallen outlines how the class method works pretty darn well :)

Closing for the moment, but if you encounter any bugs, @henry.wright, do let us know.

Last edited 8 years ago by r-a-y (previous) (diff)

#3 @r-a-y
8 years ago

  • Component changed from API to API - Emails
  • Milestone set to Awaiting Review
  • Resolution worksforme deleted
  • Status changed from closed to reopened

Maybe you are referring to how BP sets the Reply-To email header with the site admin's email address:

I do find this a little weird as well.

Reopening for feedback.

#4 @DJPaul
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

I chatted with Henry about this some time ago and I recall it was a misunderstanding with the function name.

@r-a-y The reply-to email address should be a valid address. Technically, the FROM address should also be valid, but since WordPress makes up a fake email address, setting the reply-to at least will route responses to the right place.

(During 2.5 dev, I tried experimenting with setting FROM in this way, and that quickly revealed a lot of compatibility problems, so I left that out.)

Note: See TracTickets for help on using tickets.