musisz przekodowac dany plik na base64 i wyslac z odpowiednim naglowkiem:
<?
$png = fopen
("c:\\plik.png", "rb");
$contents = fread($png, 300);
$encoded_attach = chunk_split(base64_encode
($contents));
fclose($png);
// naglowki w zaleznosie text czy jpg zmieniasz Content type
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: image/png;
name='giftcertpaid.png'\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment\r\n";
$headers .= "$encoded_attach\r\n";
/* dodatkowy naglowek */
$headers .= "From: Alojzy <[email protected]>";
/* i wysylka */
mail($to, $subject, $msg, $headers);
?>
musisz pokombinowac juz nie pamietam jak to bylo dokladnie
a tu jest przyklad z uzyciem klasy:
<?php
error_reporting(63);
include_once('class.html.mime.mail.inc');
define('CRLF', "\r\n", TRUE);
$mail = new html_mime_mail(array('X-Mailer: Html Mime
Mail Class'));
$attachment = $mail->get_file('newsletter.jpg');
$text = 'THIS IS TEXT PART OF THE EMAIL MESSAGE!';
$mail->add_text($text);
$mail->add_attachment
($attachment, 'newsletter.jpg', 'image/jpeg');
$mail->build_message();
// TO NAME, TO EMAIL, FROM NAME, FROM EMAIL, SUBJECT
$mail->send('Richard
Heyes', '[email protected]', 'From
Name, '[email protected]', 'Example email using HTML
Mime Mail class');
print "<h1>done</h1>\n";
?>
klase mozesz pobrac stad:
http://www.release.pl/htmlMimeMail-2.5.2.zip