pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
684 stars 348 forks source link

[BUG] Send-PnPMail using Array not working as expected #4293

Closed svermaak closed 1 month ago

svermaak commented 2 months ago

Reporting an Issue or Missing Feature

Send-PnPMail using Array not working as expected

Expected behavior

The command to send email out to all users in $to array

Actual behavior

Command randomly does not send to one or two users (usually the same two)

Steps to reproduce behavior

Not working Send-PnPMail -To $to -Subject "Test from M365" -Body "Please disregard this test email - Regards Shaun Vermaak" -Connection $connection

Working Send-PnPMail -To 'a','b','c','d','e','f','g','h','i','j' -Subject "Test from M365" -Body "Please disregard this test email - Regards Shaun Vermaak" -Connection $connection

What is the version of the Cmdlet module you are running?

Latest

Which operating system/environment are you running PnP PowerShell on?

gautamdsheth commented 1 month ago

If its random , not sure what could be the issue. Are there any errors related to this, maybe check logs or something ? Can't reproduce this locally. Is there a way to reliably repro the issue ?

KoenZomers commented 1 month ago

Just had a look at the sourcecode here as well. We pass on all TO addresses in one go to Microsoft Graph. We don't apply individual processing on each of them. This means if some don't arrive and some do, it did arrive at Graph and the processing internally within Exchange Online fails somehow. You could check your sent items to see if the mail in there does show all to-addresses. You can also leverage the message trace features within Exchange Online Admin Center to figure out how the e-mails have been processed. I'm afraid there's nothing we can do from PnP PowerShell.