Send MIME messages in PHP (vi)

Source: Internet
Author: User
Tags mail
The other two methods that mime is worth describing are print_mail () and Send_mail (), and all two use $force parameters. Print_mail () Loss


the entire message, Send_mail () uses the PHP mail () function to send the message. Optionally, Send_mail () uses an SMTP object


and its Send method (specified by the user) to send the message.








Conclusion


creating a MIME-compliant message is not as complex as it may seem, and can be done in a fairly simple way. MIME messages can be given to


many of the site to bring the atmosphere.





The class we developed above covers the core idea, and it can be expanded, and the only limit is your imagination. For example, someone can


writes out 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 messages without modification, just embedded images cannot be sent; this is a


need special attention to the subject.





However, no image of HTML or referenced images using an absolute URL or a <BASE> tag can also be sent using the Mime_mail class. A


examples are as follows:





<?php





$html _data = ' <htm1><body text= ' #OOOOdd '


bgcolor= "#000000" ><hl>Hello</hl><body></html>;


$mime = new Mime_mail ($to, $from, $subject);


$mime->attach ($html _data, "", Octet, BASE64, INLINE);


$mime->send_mail ();





?>





the recipient of this message will get a black background and a blue "Hello" text message!





send full inline HTML information, along with other advanced topics that match MIME mail, deserve special consideration, hopefully these will become


for the continuation of this article.





This station note: The classes column of this station has mimemail class download.





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.