I am building a Bulk Messaging App. How to Handle Concurrent Email Sending in a PHP Bulk Messaging System? It sends out but have to queue all in a row [closed]

I am currently developing a bulk messaging system using PHP. My main challenge is handling concurrent email sending efficiently. When multiple users (e.g., 10 or more) initiate the sending process at the same time, the system processes emails sequentially, creating a long queue. This becomes problematic as the number of users grows, leading to significant delays. For instance, with 1000 users, it might take months for all emails to be sent.

Is there a guide out there i can read up to help.
Anyone with experience building bulk messaging system for multiple users.
My app works well, but i did it in a way that sequentially queues all in a DB before sending

Currently, when a user initiates a message, I insert it into a queue table in the database. I have a cron job that runs periodically to process these queued messages. The cron job goes through the messages in the table sequentially and sends them one by one

// Inserting message into queue table
function queueMessage($message) {
    // Database insertion logic here
}

// Cron job processing queued messages
function processQueue() {
    $queuedMessages = getQueuedMessages(); // Retrieve messages from the queue table

    foreach ($queuedMessages as $message) {
        sendEmail($message['email']);
    }
}