views:

612

answers:

3

I am trying to send mail using vb.net from iis through a smart host (mailenable) and out through the internet. When I send mail without attachments it goes out just fine. When I send mail created the same way with an attachment the smart host gets an error sending the email.

"mailenable the remote server appears to have failed or to have rejected the contents of the message"

The smart host is correctly set up with reverse dns and MX records set up correctly. What am I missing?

  • Happens with .txt and .jpg files both - Attached using system.net.mail.attachment(inputstream, attachmentname, mimetype)
  • The remote server is rejecting it
  • the smarthost is making an attempt
  • Sending attachments to the remote server using outlook works fine
+2  A: 

I would concentrate on this portion of the error:

"...rejected the contents of the message"

.. since you have confirmed that sending mail works fine without the attachment.

  • What time of attachment is it?
  • How are you attaching it?
  • Have you checked with the server admin (might be yourself) to see what types of files may be sent through that system?
Chris Ballance
A: 

Be aware that a lot of mail servers rejects email with attachments with files .exe, .bat, .cmd, etc (executables) and zip files containing any of this files.

Eduardo Molteni
A: 

Can you send the same message with a standard SMTP mail client? Alternatively, can you send the same message using your code via a different mail server (i.e., Google's Gmail IMAP server)?

Marshall Fryman