Hola!
Este no es mi código
Lo vi en el libro "PHP Professional" de wrox
Espero que te sirva
include "mime_mail.inc";
$filename = "color.gif";
$content_type = "image/gif";
# read a JPEG picture from the disk
$fd = fopen($filename, "r");
$data = fread($fd, filesize($filename));
fclose($fd);
# create object instance
$mail = new mime_mail;
# set all data slots
$mail->from = "
[email protected]";
$mail->to = "abc@mime_mail.com";
$mail->subject = "welcome!";
$mail->body = "Here goes the real
text of the e-mail. You can write over
multiple lines, of course.";
# append the attachment
$mail->add_attachment($data, $filename, $content_type);
# send e-mail
$mail->send();
?>
// store as "mime_mail.inc"
class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
/*
* void mime_mail()
* class constructor
*/
function mime_mail() {
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}
/*
* void add_attachment(string message, [string name], [string ctype])
* Add an attachment to the mail object
*/
function add_attac