You don't do this everyday, so just post it here for the record.
Steps to resend bad messages:
- Stop the SMTP Service: Open IIS Manager, right-click SMTP Virtual Server, then click Stop.
- Copy all bad message files (with extension of .bad) under Badmail folder to Pickup folder
- Remove the .bad extension
- Start the SMTP service, and watch them being redelivered.
File types under Badmail folder:
- .bad: the message failed to send
- .bdp: the diagnostic message
- .bdr: the body of the (None-delivery report) NDR.
$INETPUBHome = "C:\inetpub\mailroot"
ReplyDelete$BadMail = "$INETPUBHome\BadMail"
$Pickup = "$INETPUBHome\Pickup"
stop-service -Name SMTPSVC
foreach ($f in Get-ChildItem -Path $BadMail -Filter *.bad) {
$smpt_body = Get-Content -Path $f.FullName -Raw
$r = $smpt_body -replace "(?smi)From:[^!]+From:", "From:"
$r | Out-File -FilePath $Pickup\$($f.BaseName) -Encoding ascii
Remove-Item $f.FullName
}
start-service -Name SMTPSVC
Great post, and great website. Thanks for the information! recover deleted iMessages
ReplyDelete