Hi,

I'm using the following to send email. It works fine if I attach a text
file. However, if I attach a zip file, as shown, I get the following error
on the send:

"The transport lost its connection to the server."

If I send the same attachment via the same server using Outlook, all is
well. It only fails when sent using this script. The issue is not related
to file size, it works with huge text files, but fails on tiny zip files.

Suggestions gratefully received!

'Code begins here

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Something"
objMessage.To = "someone@somewhere.co.uk"
objMessage.From = "someone@somewhereelse.co.uk"

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mailhost.myisp.co.uk"

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

objMessage.AddAttachment "C:\attach.zip"

objMessage.Send

'Code ends here

Re: CDO send: Lost Connection by Anthony

Anthony
Fri Apr 25 11:52:18 CDT 2008

"bcap" <bcap@nospam.nowhere> wrote in message
news:4810c40a$0$26079$db0fefd9@news.zen.co.uk...
> Hi,
>
> I'm using the following to send email. It works fine if I attach a text
> file. However, if I attach a zip file, as shown, I get the following
error
> on the send:
>
> "The transport lost its connection to the server."
>
> If I send the same attachment via the same server using Outlook, all is
> well. It only fails when sent using this script. The issue is not
related
> to file size, it works with huge text files, but fails on tiny zip files.
>
> Suggestions gratefully received!
>
> 'Code begins here
>
> Set objMessage = CreateObject("CDO.Message")
> objMessage.Subject = "Something"
> objMessage.To = "someone@somewhere.co.uk"
> objMessage.From = "someone@somewhereelse.co.uk"
>
> objMessage.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
>
> objMessage.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> "mailhost.myisp.co.uk"
>
> objMessage.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
>
> objMessage.Configuration.Fields.Update
>
> objMessage.AddAttachment "C:\attach.zip"
>
> objMessage.Send
>

Triy adding something to the TextBody before attaching the zip.

The problem is that without a text body the primary message body has the
mimetype application/zip. Whilst from a mime point of view this is quite
legal there are few if any message agents which are expecting this.




--
Anthony Jones - MVP ASP/ASP.NET