Hi there,
I trying to wrap my brain around the way headers and the actual message are processed when sending the email.
for example, in addition to the "To" and "From" information in the header, I have some attachments, some text, and some HTML to separate with the boundary separators.
So I have the "Headers" strung together using the $header variable which I'll pass to the mail function later.
Here's how it should appear.
MIME-Version: 1.0
Content-Type: multipart/related;
boundary="==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx"
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx
Content-Type: multipart/alternative;
boundary="==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx"
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<html><body><font face="Arial"><img src="cid:1737e76a432350b480f4b8583f612372"><br><br><br>text<br>
<br></FONT></body></html>
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<--text-->
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx--
But it comes through as this :
MIME-Version: 1.0
Content-Type: multipart/related;
boundary="==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx"
Content-Type: multipart/alternative;
boundary="==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx"
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<html><body><font face="Arial"><img src="cid:1737e76a432350b480f4b8583f612372"><br><br><br>text<br>
<br></FONT></body></html>
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<--text-->
--==Boundary_x3d51389f7259b7dd6a7908fb5395f93cx--
I'm missing the first boundary delimeter under the [bold]Content-Type: multipart/related[/bold] section.
I have the $headers ammended to each other and then I have the $message which flows in. Here's the code:
$headers = "From: Me <me@me.net>";
$mime_boundary = "==Boundary_x1234567890x";
// Add the headers for a file attachment
$headers .= "\r\nMIME-Version: 1.0\r\n" .
"Content-Type: multipart/related;\r\n" .
" boundary=\"{$mime_boundary}\"";
$message = "\r\n> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.\r\n--{$mime_boundary}\r\n";
$headers .= "\r\nContent-Type: multipart/alternative;\r\n boundary=\"{$mime_boundary}\"";
How do I fit the $mime_boundary closing tag into the message so that it appears underneath the multipart/related content type? If I prepend $message with it, it simply moves stuff around and displays "...This message is in MIME format...." under the multipart/alternative area where it belongs.
If this doesn't make sense, ask a question here and I'll see if I cannot make it more succinct.
Thanks.