I am creating and sending emails using the System.Net.Mail namespace. The smtp.Send(mailMessage) call is being made within a using System.Transactions.TransactionScope block. If I do not create any email attachments then everything works fine. If I add any attachments (using mailMessage.Attachments.Add(attachment)) then no errors are thrown but the email is not delivered to the recipient – it just seems to disappear into the ether. Can anyone think of a reason why the addition of an attachment would result in the total failure of the email to be delivered (but no exception is raised!)
Thanks very much.
The issue is with the vbscript within \mailroot on the server to catch all emails (C:\inetpub\mailroot\Script\catchall.vbs). This is not part of my app, but I believe is installed as part of the default SMTP server that comes with Windows Server.
This script is checking emails and attachments and is blocking emails based on the attachment. The following code in the file on line 62 has been commented out.
‘if part.ContentMediaType = “application/octet-stream” then ‘Executable attachment
‘ ProcessMessage = true
‘ Exit Function
‘end if
Everything now working. Thanks for your help folks.