Quick And Simple Php Mailer
I need a custom-built PHP function to send text e-mail messages. The function should be a simplified version of the mail() function built into PHP, and it should have the following fields: to, from, subject, message, additional headers. It should return an integer indicating the result of the attempted mailing. The function will be called as follows:
$result = send_mail($to, $from, $subject, $message, $headers)
The possible return values should be:
0 – Successful
1 – Temporary error (such as full mailbox or server offline) where the mailing might be successful if tried again later.
2 – Permanent error where the mailing should not be tried again because the e-mail address is invalid and can’t be sent.
This project will just be the basic core of the mailing program, so it shouldn’t have anything complex such as a queue or log file. It should simply connect to the destination mailing server, send the message, and return the result integer.
The function should send mail as quickly and efficiently as possible, since it will be running in a loop to send a large quantity of messages at one time. The primary purpose of this project is that I need something must faster than the mail() function built into PHP.
The function will only send basic text messages, so it shouldn’t worry about any additional functionality that may be needed for images or attachments.
The function needs to be a standalone mailer, and not depend on the built-in mailing functions of PHP or a relay server. I believe the function needs to send using the SMTP protocol, but I’m not completely familiar with the underlying protocols of e-mail so please let me know if there would be a better way.
I would need complete and exclusive ownership of the finished code for this project.