PHP教程.应用实例--8
时间:2008-05-17 来源:剑心通明
php写的发送附件的程序(一)
Heyes
send
***************************************/
$mail = new html_mime_mail("X-Mailer:
[url=javascript:;]Html[/url]
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 = ' Success!';
/***************************************
** 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 '';
echo $mail->mime;
echo '';
?>
Heyes
send
***************************************/
$mail = new html_mime_mail("X-Mailer:
[url=javascript:;]Html[/url]
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 = ' Success!';
/***************************************
** 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 '';
echo $mail->mime;
echo '';
?>
相关阅读 更多 +