Forum Moderators: bakedjake
I ended up creating my own function to replace PHP's mail() function, which A) works on my new system, and B) is many times faster than PHP's mail() function. Here it is, in case you'd like to use it. It uses sockets to connect directly to the SMTP server of your choice:
function SendMail($ToName, $ToEmail, $FromName, $FromEmail, $Subject, $Body, $Header)
{
$SMTP = fsockopen("smtp.sitename.com", 25);
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "HELO sitename.com\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "MAIL From: $FromEmail\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "RCPT To: $ToEmail\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "DATA\n");
$InputBuffer = fgets($SMTP, 1024);
fputs($SMTP, "$Header");
fputs($SMTP, "From: $FromName <$FromEmail>\n");
fputs($SMTP, "To: $ToName <$ToEmail>\n");
fputs($SMTP, "Subject: $Subject\n\n");
fputs($SMTP, "$Body\r\n.\r\n");
fputs($SMTP, "QUIT\n");
$InputBuffer = fgets($SMTP, 1024);
fclose($SMTP);
}
I believe I've modified the script sufficiently that it doesn't include anything specific to my configuration.. I apologize if I haven't. You'll need to replace "smtp.sitename.com" and "sitename.com" with your server's information.
No.. you don't have to worry about the existing mail() function being there, or have to change anything else. But you do have to make sure that PHP was compiled with sockets.
<Is this script secure?>
I'm not sure what you mean. SMTP by nature is unsecure as everything is done in plain text.
<What is the recommended smtp server to use? My ISP?>
That would depend on your setup. If you are allowed to use the MTA on the box where the script runs, this would be fastest.