Php: search email that supports message queue

I am looking for an email to create an information system within our company. it should support the message queue (sending messages to the queue, automatic sending in the background) without blocking the web server. so I think that background processing should be done as background maintenance on the server, similar to aspmail, but for php.

any suggestions? thanks

0
php email
source share
5 answers

I used PEAR Mail_Queue to post 200,000 + mails at a time. Filling the database is quick and easy, even with customized content, and then a fairly simple script sends about 250 times - if the average load is not too large. Then he moves and sends the next batch. This is done from the background, and it is easy to set it up so that if the queue table is empty, it pauses for a moment before it checks again (because checking several times per second will not help anyone).

The advantage of checking the average load in the machine is that it simply goes into the queue without any problems with self-generated resource starvation.

The Mail_Queue tutorial gives you almost everything you need - just go around the "send_messages.php" script (the line is better from the command) until the database queue is empty, and then pause the time and run again.

+2
source share

I would recommend using Gearman to create a stand-alone daemon waiting for jobs sent by your web server.

There's a good article: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/ , explaining how to create daemons in pure PHP code.

On the web server side, you simply create tasks (client-client) and put them asynchronously in the transfer daemon. Then you have the php daemon daemon waiting for jobs to complete (working mechanism), and execute them when they become available in the queue.

If you have a huge number of emails to send, you can even deploy workers on several servers that will wait in the same job queue to optimize email processing.

+4
source share

it should support the message queue (sending messages to the queue, automatic sending in the background) without blocking the web server. so I think that background processing should be done as background service on the service

WTF? Queue management is the operation of the email system β€” its what has been developed is not the responsibility of the application talking to it. And if your mail server is blocked every time you send a message, there is something very wrong.

It sounds like you're trying to write your own MTA instead of fixing what is wrong with your current position.

If you need to provide standalone capabilities, install MTA on a machine running PHP.

+1
source share

You can use redis as a message queue :

message queue

Redis is a very fast and actively developed data structure server. Writing something with redis will be as easy as pie. Why I like redis in other message queues:

  • actively developing.
  • Redis:

    open source, advanced keystore. It is often referred to as a server data structure with keys that may contain strings, hashes, lists, sets, and sorted sets.

    It is very powerful.

  • Very simple installation: make .
  • has c-bindings in almost any preferred language.
  • The hiredis client library is very user friendly. You can write something in C if you want really good performance. In this example (thanks to hiredis) I only created compilations using only make .
+1
source share

Due to the nature of what is required, I don’t think this solution is out of the box specifically for MTA responsibilities, however I could be wrong.

I recently created something similar, which is related to sending emails to the database queue indicating the field if it was sent or not, and then run the CRON task to process the sending script for the set of packages, send these letters and mark them as sent. rinse and repeat.

It would be interesting to talk to you via email / msn to see what you have planned for the system, because I basically do the same.

+1
source share

All Articles