Sonntag, 5. April 2009

SMTP mit php5


//Postausgangsserver/ SMTP: "smtp.IhreDomain.de" (Port 25)
//Benutzername/Kontoname
//Postausgangsserver/SMTP

$smtp_server = "smtp.IhreDomain.de";
$port = 25;
$mydomain = "smtp.IhreDomain.de";

$username = "xxxxxxxx";

$password = "xxxxxxxxx";
$sender = "control@smtp.IhreDomain.de";
$recipient = "irgendwas@IhreDomain.de";
$subject = "test";
$content = "Nachricht ";

// Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO ".$mydomain."\n");

// SMTP authorization
fputs($handle, "AUTH LOGIN\n");
fputs($handle, base64_encode($username)."\n");
fputs($handle, base64_encode($password)."\n");
// Send out the e-mail
fputs($handle, "MAIL FROM: ".$sender."\n");
fputs($handle, "RCPT TO: ".$recipient."\n");
fputs($handle, "DATA\n");
fputs($handle, "To: ".$recipient."\n");
fputs($handle, "Subject: ".$subject ."\n");
fputs($handle, $content."\n");
fputs($handle, ".\n");

// Close connection to SMTP server
fputs($handle, "QUIT\n");
echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";

echo(fgets($handle))."
";


?>

Keine Kommentare:

Kommentar veröffentlichen