smtp mail mit php script verschicken

vor einem Jahr

Ich würde gerne eine Mail aus den Eingaben eines Formulars auf meiner Homepage generieren und versenden. Mit der php mail Funktion klappt das auch soweit, aber sobald ich smtp nutzen will stecke ich fest. Die Bibliothek, die ich zum Versenden der Mail nutzen will lässt sich nicht nutzen. Ich habe die phpMailer Master manuell auf dem Server entpackt, weil ich composer nicht hier nutzen kann. Die Ausgabe beim Ausführen des Scripts ist "das Script wird ausgeführt" wenn die Bibliothek geladen werden soll. Hat jemand eine Idee wie sich das lösen lässt? Das ist mein Script:

 

<?php

 

echo "das script wird ausgeführt";

 

require './usr/share/php/PHPMailer/src/Exception.php';
require './usr/share/php/PHPMailer/src/PHPMailer.php';
require './usr/share/php/PHPMailer/src/SMTP.php';


echo "die bib wird geladen";

 

$from = "mini <me@mydomain.de>";
$to = "maus <me@mydomain.de>";

$subject = "Hi!";
$body = "Hi,How are you?";
$host = "securesmtp.t-online.de";
$port = 465;
$username = "me@mydomain.de";
$password = "pswrd";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);

$smtp = Mail::factory('smtp', array ('host' => $host,
'port' => $port,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Mail gesendet!</p>");
}
?>

209

6

    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Das könnte Ihnen auch weiterhelfen

    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...