``` Powershell
Importer de nødvendige moduler
Import-modul Microsoft.Exchange.Connection.Powershell
Import-modul Microsoft.PowerShell.Utility
Opret forbindelse til Exchange Online ved hjælp af dine legitimationsoplysninger
$credential =Get-Credential
$session =New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection
Opret en variabel til at gemme e-mail-mappen
$folderName ="Indbakke"
Få beskederne fra din angivne mappe
$messages =Get-Message -Session $session -Mappe "$folderName"
Slå gennem alle meddelelser, og vis e-mail-teksten
foreach ($message i $messages)
{
Write-Host "Fra:$($message.Sender)"
Write-Host "Emne:$($message.Subject)"
Write-Host "Body:$($message.Body)"
# Write-Host "Attachments:$($message.attachments.name)"
}
```