Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Aug 3, 2020
1 parent 3e99629 commit f0d3173
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Examples/Example-SendEmail-Graph.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Import-Module $PSScriptRoot\..\Mailozaurr.psd1 -Force

# It seems larger HTML is not supported. Online makes sure it uses less libraries inline
$Body = EmailBody {
EmailText -Text 'This is my text'
EmailTable -DataTable (Get-Process | Select-Object -First 5 -Property Name, Id, PriorityClass, CPU, Product)
} -Online

# Credentials for Graph
$ClientID = '0fb383f1'
$DirectoryID = 'ceb371f6'
$ClientSecret = 'VKDM_'

$Credential = ConvertTo-GraphCredential -ClientID $ClientID -ClientSecret $ClientSecret -DirectoryID $DirectoryID

# Sending email
Send-EmailMessage -From @{ Name = 'Przemysław Kłys'; Email = '[email protected]' } -To '[email protected]' `
-Credential $Credential -HTML $Body -Subject 'This is another test email 1' -Graph -Verbose -Priority High

# sending email with From as string (it won't matter for Exchange )
Send-EmailMessage -From '[email protected]' -To '[email protected]' `
-Credential $Credential -HTML $Body -Subject 'This is another test email 2' -Graph -Verbose -Priority Low
4 changes: 2 additions & 2 deletions Private/ConvertTo-GraphAddress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function ConvertTo-GraphAddress {
} else {
@{
emailAddress = @{
address = $From.Email
name = $From.Name
address = $From.Name
#name = $From.Name
}
}
}
Expand Down

0 comments on commit f0d3173

Please sign in to comment.