Persits Software, Inc. Knowledge Base Articles

Problems with unexpected header text in message body

Problem Description

When sending messages with AspEmail, unexpected text such as the following appears in the message body, and the message and attachments do not come through correctly.

Date: Mon, 10 May 2004 09:02:05 +0200
Message-ID: <20040510-09020502-1030@NORETIBOL01>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="--=C5E84877A50A447E8D87_59A4_6A4C_168A"

Solution

In general, this happens when the SMTP server and/or recipient email client incorrectly interpret header information, placing it in the body of the message instead.

The most common cause of this is passing a value to a header field (such as Mail.AddAddress or .Subject or .From) that includes a line-break character, which causes the SMTP server to think that the headers have ended and the message body has begun. Examine where your code is getting the variables that you pass to all the header fields, and ensure that the data doesn't have any line-break characters in it. This is a common problem when retrieving data from a database recordset - inspect the data for this problem.

This can also happen if a very long line is passed for one of the header fields, confusing the SMTP server in the same way.

If the problem persists, try a different SMTP server if possible. The Microsoft IIS SMTP service can be installed on your AspEmail web server for AspEmail to use.