PHP Tutorial. application instance 10_PHP tutorial

Source: Internet
Author: User
PHP Tutorial. application instance 10. Php program for sending attachments (2 )? Phpclasshtml_mime_mail {var $ headers; var $ body; var $ multipart; var $ mime; var $ html; var $ html_text; var $ html_imagesarray (); var $ cids php program for sending attachments (2)
Class html_mime_mail {

Var $ headers;
Var $ body;
Var $ multipart;
Var $ mime;
Var $ html;
Var $ html_text;
Var $ html_images = array ();
Var $ cids = array ();
Var $ do_html;
Var $ parts = array ();

/***************************************
** Constructor function. Sets the headers
** If supplied.
***************************************/
Function html_mime_mail ($ headers = ''){
$ This-> headers = $ headers;
}

/***************************************
** Adds a html part to the mail.
** Also replaces image names
** Content-id's.
***************************************/
Function add_html ($ html, $ text ){
$ This-> do_html = 1;
$ This-> html = $ html;
$ This-> html_text = $ text;
If (is_array ($ this-> html_images) AND count ($ this-> html_images)> 0 ){
For ($ I = 0; $ I Html_images); $ I ++ ){
$ This-> html = ereg_replace ($ this-> html_images [$ I] ['name'], 'cid :'. $ this-> html_images [$ I] ['CID'], $ this-> html );
}
}
}

/***************************************
** Builds html part of email.
***************************************/
Function build_html ($ orig_boundary ){
$ Sec_boundary = '= _'. md5 (uniqid (time ()));
$ Thr_boundary = '= _'. md5 (uniqid (time ()));

If (! Is_array ($ this-> html_images )){
$ This-> multipart. = '--'. $ orig_boundary ."";
$ This-> multipart. = 'content-Type: multipart/alternative; boundary = "'. $ sec_boundary .""";

$ This-> multipart. = '--'. $ sec_boundary ."";
$ This-> multipart. = 'content-Type: text/plain '."";
$ This-> multipart. = 'content-Transfer-Encoding: 7bit '."";

Round (2 )? Php class html_mime_mail {var $ headers; var $ body; var $ multipart; var $ mime; var $ html; var $ html_text; var $ html_images = array (); var $ cids =...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.