```powershell
Importeer de vereiste modules
Importmodule Microsoft.Exchange.Connection.Powershell
Importmodule Microsoft.PowerShell.Utility
Maak verbinding met Exchange Online met behulp van uw inloggegevens
$credential =Get-referentie
$session =New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection
Maak een variabele om de e-mailmap op te slaan
$mapnaam ="Inbox"
Haal de berichten op uit de door u opgegeven map
$messages =Get-Message -Session $session -Map "$folderName"
Doorloop alle berichten en geef de hoofdtekst van de e-mail weer
foreach ($bericht in $berichten)
{
Write-Host "Van:$($message.Sender)"
Write-Host "Onderwerp:$($message.Subject)"
Schrijfhost "Body:$($message.Body)"
# Write-Host "Bijlagen:$($message.attachments.name)"
}
``` |