There is something wrong with:
$s = fsockopen($mailserver, 25);
echo '1 > '.fgets($s);
fwrite($s, 'HE开发者_如何学PythonLO');
echo '2 > '.fgets($s);
fclose($s);
Output:
1 > 220 mail.sogetthis.com ESMTP Postfix 2 >
The 220
code means the SMTP server is ready to accept commands. You're issuing a HELO
command, and the server should respond with a 250
if your last command was successful, which it is not. Try adding the mailserver domain you're connecting to after your HELO
command.
fwrite($s, "HELO domain.com\r\n");
In addition, you should include \r\n
control characters after all your commands. Notice the double-quotes around the command. That's required to use \r\n
in this case because double-quotes evaluate variables and control characters.
精彩评论