Hi,
Ein direkter Zugriff auf die Mailadresse des Kunden mittels Browser ist meines Wissens nicht möglich - ausser eventuell im IE mittels eines ActiveX-Controls oder ähnlichem.
natürlich kann man sowas programmieren, um zu testen, ob die Mail-Adresse auch tatsächlich existiert :-) und zwar gibt es dazu ein PHP-Script (s.u.)
Viele Grüße,
Lukas
---------------------------------------
validatemail.php
---------------------------------------
<?php
// Here is an example chunk of code... Normally, you'd call the
// validate email with a form or some other method to provide
// the input email address
//
// NOTE: You need to delete the /* and */ comment entries
// Minimal HTML code to test validate_email() function. Save this
// to a file to test...try different email addresses in the
// 'email_address' variable field to see how it behaves.
//
?>
<html>
<head>
<title>Validate an email address</title>
</head>
<body bgcolor="#000000" TEXT="#FFFFCC" LINK="#33CCFF" VLINK="#9999CC" ALINK="#FFFF00">
<!-- Assumes that you put the validate_email() function in a file -->
<!-- named "validatemail2.php", which is in the current directory -->
<?php
if (isset($email_address)) {
include("validatemail2.php");
$val_results = array( "", "" );
$val_results = validate_email($email_address);
if (TRUE==$val_results[0]) {
$value = "<font color="green">a valid</font>";
}
else {
$value = "<font color="red">not a valid</font>";
}
// print debugging info
print("<br>Debugging Info:<br><br>");
print("<pre>");
print("(valid/not valid) <font color="white">value</font> is: ".$value."<br>");
print("(true/false valid email) <font color="white">val_results[0]</font> is: ".$val_results[0]."<br>");
print("(SMTP code if false) <font color="white">val_results[1]</font> is: ".$val_results[1]."<br>");
print("(true/false valid MX host) <font color="white">val_results[2]</font> is: ".$val_results[2]."<br>");
print("(MX host that answered) <font color="white">val_results[3]</font> is: ".$val_results[3]."<br>");
print("</pre>");
print("<pre>true is represented by a 1 (one)<br>false is represented by null output</pre><br>");
// end debugging info
print( "The address <font color="white"><tt><u>".$email_address."</u></tt></font> is ".$value." email address.");
}
else {
echo <<<EOT
<form method="post" action="$PHP_SELF">
<input type="text" name="email_address" size="40" maxlength="40"><br>
<input type="submit" value="Prüfe E-Mail-Adresse">
</form>
EOT;
}
?>
</body>
</html>
---------------------------------------
validatemail2.php
---------------------------------------
<?php
/*
Validatemail2
This code is used to validate that an email address can actually accept email.
Call validateEmail() and pass it in an email address string like "jon@clearink.com".
It will return an array. $code[0] is whether it was a valid email or not and
$code[1] is the SMTP error message if there was.
By: Jon S. Stevens jon@clearink.com
Copyright 1998-1999 Jon S. Stevens, Clear Ink
This code has all the normal disclaimers.
It is free for any use, just keep the credits intact.
*/
function validate_email($email) {
global $SERVER_NAME;
$code = array(FALSE, "");
list($user, $domain) = split("@", $email, 2);
$tld = $domain;
if (checkdnsrr($tld, "MX")) { /* NOTE: checkdnsrr not implemented on Windows platforms */
if (getmxrr($tld, $mxhosts, $weight)) {
for ($i = 0; $i < count($mxhosts); $i++) {
$fp = fsockopen($mxhosts[$i], 25);
if ($fp) {
$s = 0;
$c = 0;
$out = "";
set_socket_blocking($fp, FALSE);
do {
$out = fgets($fp, 2500);
if (ereg("^220", $out)) {
$s = 0;
$out = "";
$c++;
}
else if (($c > 0) && ("" == $out)) {
break;
}
else {
$s++;
}
if (9999 == $s) {
break;
}
} while ("" == $out);
set_socket_blocking($fp, TRUE);
fputs($fp, "HELO $SERVER_NAME\n");
$output = fgets($fp, 2000);
fputs($fp, "MAIL FROM: <info@".$tld.">\n");
$output = fgets($fp, 2000);
fputs($fp, "RCPT TO: <$email>\n");
$output = fgets($fp, 2000);
if (ereg("^250", $output)) {
$code[0] = TRUE;
}
else {
$code[0] = FALSE;
$code[1] = $output;
}
fputs($fp, "QUIT\n");
fclose($fp);
if (TRUE == $code[0]) {
break;
}
}
}
}
}
return ($code);
}
?>