I have found that if an attachment whose size is n*45+14
is attached using NewMail, the attachment is corrupted,
and can not be read by the recipient. If the attachment
is an RTF file, Word 2003 refuses to open it at all,
giving a pop-up saying "Word experienced an error trying
to open the file." Wordpad opens the file, with a bit of
garble at the end.
We have worked round the problem by checking the file
size when it is generated, and if appropriate adding CR
LF to the end (outside the RTF terminator).
The problem seems to have been introduced when Service
Pack 3 for Windows 2000 Server was installed in June 2003.
The problem can be reproduced with the following .vbs
script, run with cscript:
Set objSendMail = CreateObject("CDONTS.NewMail")
objSendMail.To = "recip@Company.com"
objSendMail.From = "from@Company.com"
objSendMail.Subject = "Test with attachment"
objSendMail.Body = "Just testing - JRL"
objSendMail.AttachFile "C:\attch.txt"
objSendMail.Send
Set objSendMail = Nothing
If the file attch.txt is exactly 59 bytes long (or any
other size that is n*45+14), the attachment to the email
will be 69 bytes long, with the last few bytes corrupt.
The cause is that the attachment is sent uuencoded, and
if the number of bytes to be encoded into the last data
line of the uuencoded stream is 14, the first character
on the line is ">" when it ought to be "." . On my (UK)
keybourd these are on the same key - I wonder if there is
a lookup table with a wrong value in it?