1) { $headers = join("\r\n", $headers); } else { $headers = $headers[0]; } } $headers = chop($headers); // Make sure there are no bare linefeeds in the headers $headers = preg_replace("/(?, "; } // Ok now we tell the server we are ready to start sending data fputs($socket, "DATA\r\n"); // This is the last response code we look for until the end of the message. server_parse($socket, "354"); // Send the Subject Line... fputs($socket, "Subject: $subject\r\n"); // Now the To Header. fputs($socket, "$to_header\r\n"); // Now any custom headers.... fputs($socket, "$headers\r\n\r\n"); // Ok now we are ready for the message... fputs($socket, "$message\r\n"); // Ok the all the ingredients are mixed in let's cook this puppy... fputs($socket, ".\r\n"); server_parse($socket, "250"); // Now tell the server we are done and close the socket... fputs($socket, "quit\r\n"); fclose($socket); return TRUE; } ?>