欢迎光临
我们一直在努力

PHP教程.应用实例9-PHP教程,PHP应用

建站超值云服务器,限时71元/月

php写的发送附件的程序(一)

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. dont

** 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(,szw@phpexe.com, from name, szw@phpexe.com, subject,);

/***************************************

** debug stuff. entirely unnecessary.

***************************************/

echo <pre>;

echo $mail->mime;

echo </pre>;

?>

 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » PHP教程.应用实例9-PHP教程,PHP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章