Is there a way to send hundreds or thousands of emails at a time using SMTP or sockets? I run a Student Union mailing list, using a PHP web application, and need to send up to a couple of thousand emails at a time. Currently I retrieve the email addresses from a database, then loop through them and use the mail() function for each recipient. This is very inefficient, and it sometimes takes minutes to run the script.
Is it possible to use PHP to open a connection to the mail server, send all the emails, then close the connection?