How to make mailing queue using php’s mail() function

You can write your own wp_mail function that will override the core one and in your own function you can enqueque emails, and then dequeue them and send them with wp-crom events. Managing the queue is not trivial but should be doable.

But the easier path is to use an external service that has an API like mailchimp.