How to fix WINMAIL.DAT in Office 365

With the following commands you can disable TNEF which can be the cause of WINMAIL.DAT attachments in the email.

$Cred = Get-Credential
Connect-msolservice -credential $Cred

Type in your Office365 admin user credentials.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Set-RemoteDomain Default -TNEFEnabled $false
Remove-PSSession $Session

Read More