heyes
<?
error_reporting(63);
include('class.html_mime_mail.inc');
/***************************************
** example of usage.
***************************************/
/***************************************
** read the file background.gif into
** $backgrnd.
***************************************/
$filename = 'background.gif';
$backgrnd = fread($fp = fopen($filename, 'r'), filesize($filename));
fclose($fp);
/***************************************
** read the file test.zip into $attachment.
***************************************/
$filename = 'example.zip';
$attachment = fread($fp = fopen($filename, 'r'), filesize($filename));
fclose($fp);
/***************************************
** create the mail object. optional headers
** argument. do not put from: here, this
** will be added when $mail->send
***************************************/
$mail = new html_mime_mail("x-mailer: html mime mail class/r/n");
/***************************************
** if sending an html email, then these
** two variables specify the text and
** html versions of the mail. don't
** have to be named as these are. just
** make sure the names tie in to the
** $mail->add_html() command further down.
***************************************/
$text = 'this is a test.';
$html = '<html><body background="background.gif"><font face="verdana, arial" color="#ff0000"> success!</font><p></body></html>';
/***************************************
** add the text, html and embedded images.
** each embedded image has to be added
** using $mail->add_html_image() before
** calling $mail->add_html(). the name
** of the image should match exactly
** (case-sensitive) to the name in the html.
***************************************/
$mail->add_html_image($backgrnd, 'background.gif', 'image/gif');
$mail->add_html($html, $text);
/***************************************
** if not sending an html email, then
** this is used to set the plain text
** body of the email.
***************************************/
// $mail->body = 'fsss';
/***************************************
** this is used to add an attachment to
** the email.
***************************************/
$mail->add_attachment($attachment, 'example.zip', 'application/octet-stream');
/***************************************
** builds the message.
***************************************/
$mail->build_message();
/***************************************
** sends the message. $mail->build_message()
** is seperate to $mail->send so that the
** same email can be sent many times to
** differing recipients simply by putting
** $mail->send() in a loop.
***************************************/
$mail->send('','[email protected]', 'from name', '[email protected]', 'subject','');
/***************************************
** debug stuff. entirely unnecessary.
***************************************/
echo '<pre>';
echo $mail->mime;
echo '</pre>';
?>
新闻热点
疑难解答