Use PHP to send MIME mail (6) _ PHP Tutorial

Source: Internet
Author: User
Use PHP to send MIME mail (6 ). The other two limodou methods are print_mail () and send_mail (), both of which use the force parameter. Print_mail () outputs the entire email information. send_mail () uses php (as the current main limodou

The other two methods are print_mail () and send_mail (), both of which use the $ force parameter. Print_mail () outputs the entire email information. send_mail () uses the mail () function of php (as the mainstream development language) to send information. (Optional) send_mail () uses an SMTP object and its sending method (specified by the user) to send emails.


Conclusion
Creating a MIME-compliant information is not as complex as it looks, and can be implemented in a rather simple way. MIME messages can bring new weather to many sites.

The class we developed above covers the core idea and can be expanded. The only restriction is your imagination. For example, someone can write the detach () function to delete the attachment of the specified index (the attach () method can return this information ).

This MIME_mail class can be used to send HTML-based emails without modification, but embedded images cannot be sent. this is
Topics that require special attention.

However, HTML without images or referenced images use absolute URLs or You can also use the MIME_mail class to send the flag. I
Example:


$ Html_data = Hello ;
$ Mime = new MIME_mail ($ to, $ from, $ subject );
$ Mime-> attach ($ html_data, "", OCTET, BASE64, INLINE );
$ Mime-> send_mail ();

?>

The recipient of this email will receive an email with a black background and blue "Hello" text!

It is worth special consideration to send complete in-line HTML information, along with other advanced topics for MIME-compliant mail sending. We hope these will become the continuation of this article.

For the MIME_mail class, you can download the zip package here for constant files and running instances.

The other two methods that the http://www.bkjia.com/PHPjc/509089.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/509089.htmlTechArticlelimodou is worth noting are print_mail () and send_mail (), both of which use the force parameter. Print_mail () outputs the entire email information. send_mail () uses php (as the current master...

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.