由于很难找到答案,我认为这可能是不可能的。如果是这样,请确认它是不可能的。
使用最新版本的PHPMailer,可以非常简单地完成。
require_once 'phpmailer/class.phpmailer.php';
require_once 'phpmailer/class.smtp.php';
$mail = new PHPMailer(true);
$mail->SMTPAuth = true;
$mail->Username = 'email@example.com';
$mail->Password = 'my_awesome_password';
$mail->Host = 'smtp.example.com';
$mail->Port = 465;
// This function returns TRUE if authentication
// was successful, or throws an exception otherwise
$validCredentials = $mail->SmtpConnect();
$mail->SMTPSecure = 'ssl';
。$validCredentials = false;
try {
$validCredentials = $mail->SmtpConnect();
}
catch(Exception $error) { /* Error handling ... */ }
这并非不可能。
您可以自己编写SMTP交互程序,并在SMTP协议中检查凭据是否被接受的确认。对于这种方法,您需要与SMTP服务器进行套接字级通信(例如使用[PHP Sockets]服务1)。
要了解SMTP协议的工作原理,请尝试手动使用Telnet进行操作。
http://technet.microsoft.com/en-us/library/aa995718(v=exchg.65).aspx