Files
dog/php/php-dog/tstEmail.php
2023-02-08 16:09:00 +01:00

41 lines
1.1 KiB
PHP

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require '../../vendor/autoload.php';
require './classes/lib.php';
//Create an instance; passing `true` enables exceptions
$mail = new CNetcupMailer(true);
//$mail = new PHPMailer(true);
try {
//Server settings
//Recipients
$mail->setFrom('p.para@gmx.de', 'Mailer');
$mail->addAddress('p.hoppe@gmx.de', 'Joe User'); //Add a recipient
$mail->addReplyTo('p.para@gmx.de', 'Information');
$mail->addCC('p.para@gmx.de');
$mail->addBCC('dog@hope-fly.de');
//Attachments
//Content
$mail->Subject = 'aaaa jo subject jo XXXXX';
$mail->Body = 'aaaaaa XXXX This is the txt message bodyThis is the txt message body This is the txt message bodyThis is the txt message body';
// $mail->send();
// echo 'Message has been NOT sent';
$mail->send();
echo 'Message has been sent';
}
catch (Exception $e)
{
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>