I've noticed that mail() takes up to 0.7 seconds of your script to send it. I believe that it's because it waits for confirmation.
Now, there are certain mail servers which you access. For example, I am using with my localhost the ISP host. That's the one who provides my Internet, for those who don't know.
Now, I've heard that PHP makes sure that the mails are being sent. Next to that, there are certain programs that allow instant sending (large newsletters, also phpBB uses it) in an instant. When the script is executed, it's all up to the mailserver. Then you're going on to the whole idea of spamming. People imput sleep(#); between the for loops to send emails. This is to prevent an overload and to prevent the mailserver from complaining.
Anyways, now the question is, how hard is it to make your own. I've seen scripts like phpMailer and SwiftMailer, but I rather create my own. Not only to gain in-depth knowledge but I like the challenge as well. That way, I do not have to rely on other systems to do your job for ME. (like lawyers...)
Can you guys give me some possibilities here? Since I am out of options and everytime I send a mail, I am annoyed by the load time.
Quite simply really. Probably the best way is to connect using fsockopen and then send the data using fputs/fwrite. SMTP, as it's a protocol, has commands such as: HELO TalkPHP.
You'll be able to find the RFC for the SMTP protocol in many locations, though I don't know its RFC number off hand. Even HowStuffWorks, if you go to the "How Email Works" article - that will give you a basic run down of how to send an email using SMTP via Telnet on the 3rd or 4th page in the article; if I remember rightly. Same principle applies to sending the email through a PHP script.
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.