Persits Software, Inc. Knowledge Base Articles

Messages sent by AspEmail appear truncated and may contain stray characters

Problem Description

When trying to send a message with AspEmail that is longer than a few hundred characters, the received message appears truncated and sometimes contains stray characters such as '!'.

Solution

This occurs because your mail server imposes a restriction on the length of individual lines in a message body. According to SMTP specifications, this limit is 76 characters per line. To ensure that your message does not contain lines longer than 76 characters, you can:

1. Insert end-of-line character pairs chr(13) & chr(10) into your message body as follows:

Mail.Body = "line 1" & chr(13) & chr(10) & "line 2" etc.

or

2. Use the Quoted-Printable feature of AspEmail by setting

Mail.ContentTransferEncoding = "Quoted-Printable"

which will format your message automatically to conform to the 76-character-per-line restriction.