I've made it the bad way... I sent myself a sample e-mail that looked like what i wanted to do, then i've read the source of it. After that, i simply used 'mail()' with the 'not really' generated e-mail. Just a little note : mail does itself any encoding/conversion that should be done.
Here's my sample:
$message = "This is a multi-part message in MIME format.\n\n";
$message .= "------=NextPart_000_013E_01C00C65.278DAB80\nContent-Type: multipart/alternative;\n\tboundary=\"----=NextPart_001_013F_01C00C65.278DAB80\"\n\n\n------=_NextPart_001_013F_01C00C65.278DAB80\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\n";
$message .= "Some text";
$message .= "------=_NextPart_001_013F_01C00C65.278DAB80\n";
$message .= "Content-Type: text/html;charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n\n";
$message .= "\n";
$message .= "<head>\n<title>blahblah</title>\n";
[... Some more html ...]
$message .= "------=_NextPart_001_013F_01C00C65.278DAB80--\n\n";
$message .= "------=_NextPart_000_013E_01C00C65.278DAB80\n";
$message .= "Content-Type: image/jpeg; name=\"$carte.jpg\"\nContent-transfer-Encoding: base64\nContent-Location: http://www.foo.com/x/" . $x . ".jpg\n\n";
if (is_readable("$x".".jpg")) {
$fd = fopen("$x".".jpg", "r");
$contents = fread($fd, filesize("$carte".".jpg"));
$encoded = chunk_split(base64_encode($contents));
fclose($fd);
}
$message .= $encoded;
$message .= "\n\n------=_NextPart_000_013E_01C00C65.278DAB80--";
@mail("$nameDest <$mailDest>", "$displayname send you some mail", $message, $header);
$x is set to be the filename without extension. I've made it set in a form...
Hope this helps...