开发者

SMTP connection using PHP errors

开发者 https://www.devze.com 2023-02-04 23:32 出处:网络
There is something wrong with: $s = fsockopen($mailserver, 25); echo \'1 > \'.fgets($s); fwrite($s, \'HE开发者_如何学PythonLO\');

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消