How to put the output of script to a text file then mail it.

I have the below script that deletes only the attachments of an email not the email itself of a certain user it work great and gives out a great output in powershell ISE but what i will like for it to do is to grab the output put it into a text file and then mail it to the user any help will be greatly appreciated thank you 

#The module lives on the NY share drive
Import-Module -Name “\\homelabco.com\dfsshared\Infra\NY\Documentation\cleanup_Sentitems_attachments\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll”
$exchangesession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri ntex007.homelabco.com/.../ -Authentication Kerberos
Import-PSSession $exchangesession
function doFolder($inFolder) {
write-host “Folder:” $inFolder.displayName
$items = $inFolder.FindItems($itemFilter, $itemView)
foreach ($item in $items.Items) {
write-host $item.Subject
if ((New-TimeSpan (Get-Date) $item.DateTimeReceived).Days -lt 14) {
$item.Load()
foreach($attachment in $item.Attachments) {
write-host $attachment.Name
$item.Attachments.Remove($attachment)
}
$item.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AutoResolve)
}
}
$folders = $service.FindFolders($inFolder.Id, $folderView)
foreach ($folder in $folders.Folders) {
doFolder($folder)
}
}

$userinput=Read-Host -Prompt "please enter your username"
$passwordinput=Read-Host "please enteryour password"
$credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials($userinput,$passwordinput)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010)
$service.Credentials = $credentials
$service.Url = "ntex007.homelabco.com/.../exchange.asmx"
$mailbox = Get-Mailbox $userinput
$folderView = New-Object Microsoft.Exchange.WebServices.Data.FolderView(1000)
$folderView.Traversal = [Microsoft.Exchange.WebServices.Data.FolderTraversal]::Shallow
$itemFilter = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::HasAttachments, $true)
$itemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(10000)
write-host $mailbox.displayName
# you can change the below to "deleteditems" "outbox" or "sentitems"
$folderId = New-Object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::DeletedItems, $mailbox.primarySmtpAddress.ToString())
$folder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, $folderId)
doFolder($folder)