PHP Asynchronous e-mail Problem _php Tutorial

Source: Internet
Author: User
Tags php send mail

PHP Asynchronous e-mail issue


Demand:

In a system, upload a product patch file or release product update information, need to use the product users (more users) send an e-mail, sent after the prompt sent!

Our common PHP code is written as follows:

 

Let's say 100 messages are sent this time. What will happen to this operation?

User experience: User wait-and-send message completion--return information (this period is very likely, script execution timed out)

This operation due to the need to send a large number of messages, resulting in PHP execution time is too long, the user impatient waiting. When Apache or Nginx waits beyond the allowed execution time, a timeout error is returned. This time the user is not clear whether this operation is successful or not, in the end sent a few emails.

From this we can see that the above code user experience is very poor, and can not successfully complete the task.

So how to solve the problem of poor user experience?

A concept is mentioned here that executes asynchronously

User experience: User waits, Send complete

Friends will ask, how to lack the sending link?

OK, send a link in the user submits the request, the letter to the task to a separate processing of the PHP program processing, when the user saw "send complete" when the fact that the message has not been sent, this time, the sending process is working in the background, a lunar sealed outward sent.

  

Articles you may be interested in

    • How to solve the problem of concurrent read and write file conflicts in PHP
    • PHP Send mail component
    • Compress website js and CSS files using PHP's gzip compression to speed up website access
    • How to optimize server, static, database optimization, load balancing to achieve high load for large traffic website
    • JavaScript solves the problem of left and right height adaptive
    • PHP addresses URL encoding problem functions UrlEncode (), UrlDecode (), Rawurlencode (), Rawurldecode ()
    • Use PHP function memory_get_usage to get the current PHP memory consumption to achieve program performance optimization
    • Send mail SMTP Error Could not connect to SMTP host. Solution for Send fail

http://www.bkjia.com/PHPjc/901423.html www.bkjia.com true http://www.bkjia.com/PHPjc/901423.html techarticle PHP Asynchronous e-mail problem requirements: In a system, upload a product patch file or release product update information, need to use the product users (more ...

  • 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.