文件
Parlz/test_smtp_163.php
T
2026-06-04 22:42:27 +08:00

52 行
1.4 KiB
PHP

<?php
// 测试网易企业邮SMTP配置
require_once 'vendor/autoload.php';
echo "<h1>测试网易企业邮SMTP配置</h1>";
echo "<pre>";
$config = [
'host' => 'smtp.qiye.163.com',
'username' => 'noreply@parlz.com',
'password' => 'Zzr20130731'
];
echo "测试服务器: {$config['host']}\n\n";
// 测试TCP连接
$start = microtime(true);
$socket = @fsockopen($config['host'], 25, $errno, $errstr, 10);
$time = round((microtime(true) - $start) * 1000, 2);
if ($socket) {
echo "✓ TCP连接成功 ({$time}ms)\n";
// 发送EHLO命令
fwrite($socket, "EHLO test\r\n");
$response = fgets($socket, 1024);
echo "EHLO响应: " . trim($response) . "\n";
// 发送AUTH LOGIN命令
fwrite($socket, "AUTH LOGIN\r\n");
$response = fgets($socket, 1024);
echo "AUTH响应: " . trim($response) . "\n";
// 发送用户名(base64编码)
$encodedUser = base64_encode($config['username']);
fwrite($socket, $encodedUser . "\r\n");
$response = fgets($socket, 1024);
echo "用户名响应: " . trim($response) . "\n";
// 发送密码(base64编码)
$encodedPass = base64_encode($config['password']);
fwrite($socket, $encodedPass . "\r\n");
$response = fgets($socket, 1024);
echo "密码响应: " . trim($response) . "\n";
fclose($socket);
} else {
echo "✗ TCP连接失败: $errstr (errno: $errno)\n";
}
echo "</pre>";
?>