PRB: CDONTS Line Length is Limited to 74 Characters (201352)



The information in this article applies to:

  • Collaboration Data Objects (CDO) for NTS 1.2

This article was previously published under Q201352

SYMPTOMS

When sending a plain text message using CDONTS, your line length is limited to 74 characters. If the line length is more than 74 characters, the line will be broken down into several lines. This happens when setting the text property of a CDONTS NewMail object.

RESOLUTION

You can work around this problem by setting the MailFormat and BodyFormat properties of the CDONTS object, or the MessageFormat property of the Message object to send MIME formatted mail. The default setting for these properties is to send plain text.

STATUS

This behavior is by design.

MORE INFORMATION

The following code samples show how to set the appropriate properties using two different objects.

Using the CDONTS Session Object

Set objSession = CreateObject ("CDONTS.Session") 
objSession.LogonSMTP "My Name", "someone@microsoft.com"
Set objOutbox = objSession.Outbox
Set objMessage = objOutbox.Messages.Add

'Remarking out the following line will cause plain text to be sent.
objMessage.MessageFormat = 0 

objMessage.Subject = "String Length Test"
objMessage.Text = "Insert message text here" 
Set objRecipient =  objMessage.Recipients.Add 
objRecipient.Name= "My Recipient"
objRecipient.Address = "someone@microsoft.com"
objMessage.Send
Set objMessage = Nothing
Set objOutbox = Nothing
Set objSession = Nothing
				

Using the CDONTS NewMail object

   Set myMail = CreateObject("CDONTS.NewMail")

   'Remarking out the following 2 lines causes plain text to be sent.
   myMail.BodyFormat=1
   myMail.MailFormat=0

   myMail.From="someone@microsoft.com"
   myMail.To="someone@microsoft.com"
   myMail.Subject="CDONTS String Length Test"
   myMail.Body= "Insert message text here"
   myMail.Send
   Set mymail=Nothing

				

Modification Type:MinorLast Reviewed:3/4/2004
Keywords:kbMsg kbprb KB201352