msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

Missing From Model

Open adamz01h opened this issue 8 months ago • 3 comments

I was able to solve this for the time being making a copy of the Recipient model and renaming everything as From You can also just use the Recipient model vs creating a whole new model but that kinda defeats the reason to have its own names makes it hard to understand why you would be using a Recipient model for a From function. Example code of how it has been implemented.

    $rrrr = new Model\From();
    $rrrr->setEmailAddress(array('address' => $from_mailbox));
    $message->setFrom(($rrrr));

This ensures the from address is set correctly and the email will send.

adamz01h avatar Oct 24 '23 04:10 adamz01h

@adamz01h thanks for reaching out. The Message object's setFrom() expects a Recipient object.

Not sure why we needed to make a copy of the Recipient model?

Ndiritu avatar Oct 24 '23 08:10 Ndiritu

Why would you set a Recipient to set a from? How in English does that make any sense? Its not to a from address. Its From a from address.

OR You could rename the recipient model to something else that would give a more clear indication what that the model is for. Bad naming leads to confusion outcomes and code that is harder to understand.

adamz01h avatar Oct 24 '23 14:10 adamz01h

@adamz01h thanks for clarifying. I understand what you mean now. Calling it Sender or something could make more sense. Escalating this on the API design side to understand why it was named as is.

Ndiritu avatar Nov 20 '23 08:11 Ndiritu