多部分/混合电子邮件。 配有空身。 怎么了?

sending an email:

From: <...>
X-Mailer: SnowBoss
Reply-To: <...>
X-Priority: 3 (Normal)
Message-ID: <248.20091210135259@snowman2010.com>
To: <...>
Subject: =?UTF-8?B?0JzQntCZIFNVQkpFQ1Q=?=
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----------A4D921C2D10D7DB"

This is a multi-part message in MIME format.

----------A4D921C2D10D7DB
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

MY TEXT
----------A4D921C2D10D7DB
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: 8bit

<html><b>BOLD</b></html>
----------A4D921C2D10D7DB
.

<250 Data received OK. //server response

and it comes with empty body. This only happens with multipart/mixed content (tried multipart/alternative - same story)

As Tomasz mentioned, the line where you are using the boundary, you must have two hyphen at the beginning of your boundary separarator. Check the following:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="frontier"

This is a message with multiple parts in MIME format.
--frontier
Content-Type: text/plain

This is the body of the message.
--frontier
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
--frontier--

Also notice that at the last boundary, you have to put another two hyphens to indicate that it's the end.

Example taken from Wikipedia, see here.

I guess you may have boundary set wrong.

The boundary should look like

Content-Type: multipart/alternative; boundary="--------A4D921C2D10D7DB"

meaning - contain two less '-' characters. See the source of any email.

The mail ending boundary - on the other hand - should probably look like

----------A4D921C2D10D7DB--

(again, see the source of any mail message. Or read the RFC, of course :)).

I encourage you to use exisitng mailer classes, like Swift Mailer or PHPMailer. Why reinvent the wheel?

I guess you meant the line "This is a multi-part message in MIME format." as the body in the pasted snippet of the content. It depends on the email client whether it renders the body or not when the content type is set as mimepart/alternatie or mimepart/mixed. The body parts get displayed my almost all the clients.