Giter Site home page Giter Site logo

Comments (6)

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

Try using PS 7, it should provide better error reporting. Also do you have proper rights to upload files? As ReadWrite Emails? Send is not enough.

from mailozaurr.

scriptkiddy666 avatar scriptkiddy666 commented on August 25, 2024

Same with PS7 (do I have to "reinstall" the module for PS7?):
image

Yes, both, my managed identity and the app registration have Mail.Send and Mail.ReadWrite. (That should be fine, because it worked with the client secret for the same app registration.)

from mailozaurr.

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

You don't have to reinstall module.

Just to clarify:

  • Does it work for 4MB plus with Connect-MgGraph and MgGraphRequest with ClientSecret?
  • It doesn't work with Connect-MgGraph and MgGraphRequest with Certificate?

from mailozaurr.

PrzemyslawKlys avatar PrzemyslawKlys commented on August 25, 2024

And I assume in all cases the mailbox does exists? The one you're sending it with?

from mailozaurr.

scriptkiddy666 avatar scriptkiddy666 commented on August 25, 2024

You don't have to reinstall module.

Just to clarify:

  • Does it work for 4MB plus with Connect-MgGraph and MgGraphRequest with ClientSecret?
    Yes. I just tried it again (also without executing Connect-MgGraph before) by just adding the -Credential parameter with the ClientSecret. Works like a charm. (The parameter -MgGraphRequeset was not added.)
  • It doesn't work with Connect-MgGraph and MgGraphRequest with Certificate?
    Yes. I used Connect-MgGraph with my certificate before executing Send-EmailMessage.
    (-Credential parameter of Send-EmailMessage removed and -MgGraphRequest added instead.)

And I assume in all cases the mailbox does exists? The one you're sending it with?

Correct. (It's the always the same mailbox and I also tried it with a different one, but the error is the same.)

from mailozaurr.

scriptkiddy666 avatar scriptkiddy666 commented on August 25, 2024

I'm now using the following workaround without the need for a client secret:

$null = Connect-AzAccount -Identity
[System.Object]$AccessToken = (Get-AzAccessToken -ResourceTypeName 'MSGraph' -AsSecureString -WarningAction 'SilentlyContinue').Token
[System.Object]$Credentials = ConvertTo-GraphCredential -MsalToken ([System.Net.NetworkCredential]::new('', $AccessToken).Password)
[System.String[]]$Attachments = @(XXX)

Send-EmailMessage -From 'XXX' -To 'XXX' -HTML "XXX" -Subject 'XXX' -Graph -ReplyTo "XXX" -Credential $Credentials -Attachment $Attachments -DoNotSaveToSentItems

from mailozaurr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.