We have IIS setup as an SMTP relay. A relay security error caused the outbound emails to be dropped to the badmail folder for the IIS SMTP Service.
Is there any standard method for attempting to retry delivery of these emails?
We have IIS setup as an SMTP relay. A relay security error caused the outbound emails to be dropped to the badmail folder for the IIS SMTP Service.
Is there any standard method for attempting to retry delivery of these emails?
According to Microsoft support:
To replay the messages that are located in the Badmail folder, follow these steps:
Stop the SMTP service.
Open IIS Manager.
Right-click Default SMTP Virtual Server, and then click Stop.
Copy all the files that are located in the Badmail folder and that have the .bad
file name extension. Then, paste these files to the Pickup folder.
Delete the .bad
file name extension from all the .bad
files that are located in the Pickup folder.
Start the SMTP service.
Open IIS Manager.
Right-click Default SMTP Virtual Server, and then click Start.
Verify that the messages were delivered.
Alternatively, you could use the Powershell script below wonderfully created by our in-house technical guru. It drops the "Delivery Failure" part of the .BAD
file and retries the message as if it were the original send.
$INETPUBHome = "C:\inetpub\mailroot"
$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
You can open a command prompt and navigate to the badmail folder and run the following command to remove extensions on all messages:
rename *.* *.
Drag and drop them in the pickup folder.