From: Marc G. K. <ma...@it...> - 2002-02-25 19:24:05
|
Hello, Last weekend I was reading RFC 2045-2049 (MIME part 1 - part 5) and now I know how to implement composing HTML mail in SM. Needed architecture changes: get rid of the $body variabele in compose.php. Instead we should insert the $body in $msg->body. $msg = $msg->entity['x']. If we parse $msg to smtp.php then we also parse the headers belonging to that entity. Preparing the message for send becomes more simple now. The $msg->header contains type0/type1 which we need for setting the correct content-type of HTML mail. It also should be possible to set the message->header with it so we can move a lot of code from smtp.php to compose.php. SendMessage can have only 1 argument : $msg. The only thing smtp.php has to do is create the correct boundary structure and insert the parsed entity's of $msg. The structure for HTML mail (without attachements and with images) is: --000-001-boundary (entity 1) content-type=multipart/alternative (the mailclient can pick the correct boundary for display) boundary = 001-011-boundary (for example) --001-011-boundary content-type=text/plain plain text part here --001-011-boundary content-type=text/html HTML part here --001-011-boundary-- --000-001-boundary content-type = image/jpeg content-ID = $cid --001-001-boundary-- The message-header has content-type multipart/relative The relative part is because we have to insert the images in the HTML part. If we add attachements then the message->header content-type becomes multipart/mixed end the previous mentioned html-message structure becomes a part of a multipart/mixed entity so instead of "entity - deepness" 2 it goes to 3. The only problem is creating the dhtml client-side part of the code. I found out that it's simple with IE5.5 and above because you can make div's with contenteditable set. I don't know how to implement it in other browsers. In fact, I never made a HTML-page with dhtml. Are there DHTML experts out here? Any comments appreciated :-) Marc Groot Koerkamp. |