note 77564 deleted from ref.mail by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 20:05:41 +0000 |
| Subject: | note 77564 deleted from ref.mail by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155330@lists.php.net to get a copy of this message | ||
Note Submitter: nielsvandenberge at hotm dot dot dot dot dot com
----
In the post I made about the send_mail() function at 28-Aug-2007 05:15 is a small problem.
the text:
<?php
$headers .= 'MIME-Version: 1.0'.$eol.$eol;
?>
should be replaced by
<?php
$headers .= 'MIME-Version: 1.0'.$eol;
?>
With a double "end of line" you close the header of a block so then the body should start.
The Body also ends with two eol's
An e-mail is build up with some blocks, and those blocks can also contain blocks. Every block has a
header where is defined what kind of block it is (content-Type). This content can be the texts and
attachments for example.
The blocks are separated with a boundary, which is also defined in the header of a block (always
starts with two dashes). After the header of a block you should put two "end of lines"
(eol) and a boundary. The last block ends with a boundary plus two dashes (so it looks like
"--BOUNDARY--") and 2 eol's
When a block contains other blocks (like we did with the HTML/Plain text part), the blocks should be
separated by a different boundary then we used before.
So an email will look like:
Mail Header [define boundary "--123"]
2 eol
--123
header block 1 [define boundary "--456"]
2eol
--456
header block 1.1
2eol
content block 1.1
2eol
--456
header block 1.2
2eol
content block 1.2
2eol
--456--
2eol
--123
header block 2
2eol
content block 2
2eol
--123--
2eol
Have fun with it