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 images without images or referenced images use absolute URLs or <BASE> tags, or they can be sent using the MIME_mail class. I
Example:
<? Php (as the mainstream development language)
$ Html_data = $ 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.