php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2007

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 16.11.2005, 22:28  
Gast
 
Beiträge: n/a
Standard Problem beim Mail-Versand mit dem SMTP-Skript von M. Lemos

Hallo zusammen,

ich verwende für den Versand von Mails über einen GMX-Account die Klasse smtp von Manuel Lemos (http://www.phpclasses.org/browse/package/14.html).

Wenn ich das mitgelieferte Test-Script verwende funktioniert der Versand. Wenn ich hingegen meine eigene Funktion verwende, bekomme ich den folgenden Fehler: could not determine the SMTP to connect

Für beide Scripte verwende ich die gleichen Daten.

Test-Script:
Code:
<?php
	  $smtp = new smtp_class;

		$smtp->host_name=$host_name;
	  	$smtp->localhost=$localhost;
		$smtp->pop3_auth_host=$pop3_auth_host;
		$smtp->user=$mail_user;
		$smtp->realm=$realm;
		$smtp->password=$mail_password;

		
	  
		$from=$mail_from;
	  	$to=$mailaddress;
		$inhalt = $mailtext;
	  
	  $smtp->direct_delivery=0;     /* Set to 1 to deliver directly to the recepient SMTP server */
		$smtp->timeout=10;            /* Set to the number of seconds wait for a successful connection to the SMTP server */
		$smtp->data_timeout=0;        /* Set to the number seconds wait for sending or retrieving data from the SMTP server. Set to 0 to use the same defined in the timeout variable */
		$smtp->debug=0;               /* Set to 1 to output the communication with the SMTP server */
		$smtp->html_debug=1;          /* Set to 1 to format the debug output as HTML */	  
	
	if(		$smtp->SendMessage($from,
			array($to),
			array(
				"From: $from",
				"To: $to",
				"Subject: ".$betreff,
				"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
			),
			$inhalt))
		echo "Message sent to $to OK.\n";
	else
		echo "Cound not send the message to $to.\nError: ".$smtp->error."\n"
?>

Eigene Funktion:
Code:
function sendEMail($empfaenger, $betreff, $mailtext)
	{		
	  $smtp = new smtp_class;
	  //$smtp->host_name=getenv("HOSTNAME");

		$smtp->host_name=$host_name;
	  	$smtp->localhost=$localhost;
		$smtp->pop3_auth_host=$pop3_auth_host;
		$smtp->user=$mail_user;
		$smtp->realm=$realm;
		$smtp->password=$mail_password;
			  
		$from=$mail_from;
	  	$to=$mailaddress;
//	    $to = $empfaenger;
		$inhalt = $mailtext;
	  
	  $smtp->direct_delivery=0;     /* Set to 1 to deliver directly to the recepient SMTP server */
		$smtp->timeout=10;            /* Set to the number of seconds wait for a successful connection to the SMTP server */
		$smtp->data_timeout=0;        /* Set to the number seconds wait for sending or retrieving data from the SMTP server. Set to 0 to use the same defined in the timeout variable */
		$smtp->debug=0;               /* Set to 1 to output the communication with the SMTP server */
		$smtp->html_debug=1;          /* Set to 1 to format the debug output as HTML */	  
	
		if($smtp->SendMessage($from,
			array($to),
			array(
				"From: $from",
				"To: $to",
				"Subject: ".$betreff,
				"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
			),
			$inhalt))
			{
				echo "Die Nachricht wurde erfolgreich an '$to' geschickt.\n";
			}
			else
			{
				echo "Die Nachricht konnte nicht an '$to' gesendet werden.\nFehler: ".$smtp->error."\n";
			}
	}
Hat jemand eine Idee, warum es beim Test geht und bei meiner Funktion nicht?

Gruß,
Ole
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 16.11.2005, 22:37  
Gast
 
Beiträge: n/a
Standard

Wo werden die Variablen $host_name etc. definiert?
 
Alt 16.11.2005, 22:43  
Gast
 
Beiträge: n/a
Standard

In der Datei ConfigDaten.php, die in der zentralen Datei index.php included wird:

Code:
	include_once("ConfigDaten.php");  // Hier stehen die Variablen
	include_once("php/util/smtp.php");  // SMTP-Programm
	include_once("php/util/Tools.php");  // Hier ist meine Funktion
	include_once("php/_thirdparty/test_smtp.php");  // SMTP-Test
Mir kam auch gerade der Gedanke, dass die Variablen wohl nicht gesetzt sind. Mir ist nur nicht klar, warum sie im test_smtp.php Script gesetzt sind und im Tools.php nicht.

Wer weiß weiter?
 
Alt 16.11.2005, 22:45  
Gast
 
Beiträge: n/a
Standard

Dachte ich es mir doch:

http://de2.php.net/manual/en/languag...bles.scope.php
 
Alt 16.11.2005, 22:54  
Gast
 
Beiträge: n/a
Standard

Vielen Dank!

Ich lebe halt doch irgendwie in der Java-Welt
 
Alt 16.11.2005, 23:36  
Gast
 
Beiträge: n/a
Standard

Bitte bei PHP-Quellcode [php]-Tags benutzen:
Code:
PHP-Code:
 /*  Hier Quellcode posten, natürlich ohne [ code ] :-)  */ 
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Problem mit mail() Blue-Dragon PHP Tipps 2008 17 05.07.2008 22:09
problem mit mail()!!! coldi1000 PHP Tipps 2008 4 13.11.2007 22:49
[PHP] mail() Problem mit AOL Adressen horvath-media PHP Tipps 2006 25 23.03.2006 19:53
mail() und boundary Problem Gef PHP Tipps 2006 4 02.03.2006 00:47
php oder css problem? Wie konfiguriere ich mail header PHP Tipps 2006 1 28.02.2006 05:43
Problem mit mail() PHP Tipps 2006 5 08.02.2006 08:27
[Erledigt] problem mit login skript | mysql | cookie PHP Tipps 2004-2 13 07.12.2004 19:01
Mail Problem mit Anhang Spyker PHP-Fortgeschrittene 2 21.09.2004 21:41
mailen per SMTP - Problem PHP Tipps 2004 5 02.09.2004 15:28
Problem mit Formular + Mail To+ PHP-Seiten weiterleitung HTML, Usability und Barrierefreiheit 3 27.08.2004 11:06
Problem mit Mail PHP Tipps 2004 15 02.08.2004 22:55
mail - Blacklist - Problem PHP Tipps 2004 4 09.07.2004 01:04
Problem mit mail() - Funktion PHP Tipps 2004 2 06.07.2004 18:21
Ordner per Skript erstellen --> Rechte Problem PHP Tipps 2004 2 06.07.2004 14:19
[Erledigt] Php skript upload problem! PHP Tipps 2004 2 30.06.2004 00:06

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
php smtp mail script, php smtp script, smtp php script, php smtp mailer script, php mail script smtp, $smtp=new smtp_class;, php mails smtp eigener script, smtp script php, php script smtp mail, smtp mail script, http://www.php.de/php-tipps-2007/33851-problem-beim-mail-versand-mit-dem-smtp-skript-von-m-lemos.html, smtp php, php mail smtp script, php smtp test, php smtp test script, smtp versand script, php script smtp, php mailscript smtp, php script smtp mailversand, smtp mail script php

Alle Zeitangaben in WEZ +2. Es ist jetzt 17:44 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.