Send MIME messages in PHP (vi) _php tutorial

Source: Internet
Author: User
Limodou

The other two methods that are worth explaining are print_mail () and Send_mail () and two using the $force parameter. Print_mail () Outputs the entire message message, and Send_mail () uses the mail () function of PHP (which is now the mainstream development language) to send messages. Optionally, Send_mail () uses an SMTP object and its sending method (specified by the user) to send the message.


Conclusion
Creating a MIME-compliant message is not as complex as it seems, and can be achieved in a fairly simple way. MIME messages can bring a great deal of atmosphere to many sites.

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

This mime_mail class can be used to send HTML-based messages that do not need to be transformed, but embedded images cannot be sent;
Topics that require special attention.

However, HTML or a referenced image without images uses an absolute URL or Tags can also be sent using the Mime_mail class. One
An example is as follows:


$html _data = Hello ;
$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! The

sends complete inline HTML information, along with some other high-level topics that are sent in a MIME-based message, which deserves special consideration and hopefully will be the continuation of this article. The

Mime_mail class, the constant file, and the running instance can download the zip archive here.

http://www.bkjia.com/phpjc/509089.html Span id= "Indexurl" itemprop= "Indexurl" >www.bkjia.com true http://www.bkjia.com/phpjc/509089.html techarticle limodou The other two methods that are worth explaining are print_mail () and Send_mail () and two using the force parameter. Print_mail () Outputs the entire message message, 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.