Probleme mit mail()

Alles, was PHP betrifft, kann hier besprochen werden.

Probleme mit mail()

Postby HoHaHo » 26. March 2008 19:50

Hallo.

Ich entwickle auf einem Windows-Apache-Mysql-Php-System meine Internetseite und will gerade eine Form abfragen und per Mail verschicken.

Scheinbar gibt es dafür nur mail().

Ich trage also als smtp-server in der php.ini meinen mailserver(nicht localhost sondern mail.<meinserver>.com) ein.

Ergebnis ist immer ein
Fatal error: Maximum execution time of XY seconds exceeded in XY.php on line XY
der nach ca 30 Sekunden erscheint. Ungefähr zu dieser Zeit kommt dann auch eine Mail bei mir an. Schicke ich dagegen an googlemail.com kommt dort nichts an und es wird zusätzlich zum Fatal Error
553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
angezeigt.

Was ist hier los? Wie kann ich es beheben?

Dann habe ich folgendes probiert:

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.servername.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "info@servername.com"; // SMTP username
$mail->Password = "xxxx"; // SMTP password
$mail->From = "info@servername.com";
$mail->FromName = "info@servername.com";
$mail->AddAddress("info@servername.com","Honky Tonk");
$mail->AddReplyTo("info@servername.com","Information");
$mail->WordWrap = 50; // set word wrap//
$mail->AddAttachment(""); // attachment//
$mail->AddAttachment("");
$mail->IsHTML(false); // send as HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>


Ergebnis: Es bricht ohne Fehlermeldung ab und es kommt keine mail an.
HoHaHo
 
Posts: 1
Joined: 26. March 2008 19:42

Postby logout » 30. March 2008 21:41

Du willst lediglich die Daten eines Formulars per Mail verschicken?

Standard:
Code: Select all
<?php
$empfaenger = "to@test.de";
$betreff = "Deshalb";
$nachricht = "Blablabla";
$xtra = "From: from@von.de (Mr. Sender)\r\n";
$xtra .= "Content-Type: text/html\r\nContent-Transfer-Encoding: 8bit\r\n";

mail($empfaenger, $betreff, $nachricht , $xtra);
?>


In deinem Fall

Code: Select all
<?php
$empfaenger = $_POST['empfaenger'];
$betreff = $_POST['betreff'];
$nachricht = $_POST['message'];
$xtra = "From: ".$_POST['from']."\r\n";
$xtra .= "Content-Type: text/html\r\nContent-Transfer-Encoding: 8bit\r\n";

mail($empfaenger, $betreff, $nachricht , $xtra);
?>
logout
 
Posts: 33
Joined: 01. January 2008 04:13


Return to PHP

Who is online

Users browsing this forum: No registered users and 55 guests