phpmailer

Send Mail with PHPMailer as debian 10 meta-package

install on the debian server the following package:

apt-get install libphp-phpmailer

and use it as in the example below:

require("/usr/share/php/libphp-phpmailer/autoload.php");
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP(); 
$mail->SMTPAuth = false; 
$mail->SMTPSecure = false; 
$mail->SMTPAutoTLS = false; 
$mail->Host = ""; 
$mail->Port = 25; 
$mail->IsHTML(true); 
$mail->SetFrom("from@mydomain.tld"); 
$mail->Subject = "my subject"; 
$mail->Body = "my body"; $mail->AddAddress("to@anotherdomain.tld"); 
if(!$mail->Send()) { 
     echo "Mailer Error: " . $mail->ErrorInfo;
} else {
     echo "Message has been sent";
}

Send Mail with PHPMailer

require("/var/www/html/PHPMailer-master/src/Exception.php");
require("/var/www/html/PHPMailer-master/src/PHPMailer.php");
require("/var/www/html/PHPMailer-master/src/SMTP.php");

$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;
$mail->Host = "";
$mail->Port = 25;
$mail->IsHTML(true);
$mail->SetFrom("from@mydomain.tld");
$mail->Subject = "my subject";
$mail->Body = "my body";
$mail->AddAddress("to@anotherdomain.tld");

if(!$mail->Send()) {
     echo "Mailer Error: " . $mail->ErrorInfo;
} else {
     echo "Message has been sent";
}