Seite 1 von 1

[Plugin] PHPMailer Plugin for CONTENIDO

Verfasst: Do 25. Jan 2024, 10:44
von Oldperl
Servus,

da ich in letzter Zeit häufiger alte Module, die den PHPMailer nutzen, in der Mache hatte und dieser ja nicht mehr zu den Standard-Libs von CONTENIDO gehört, habe ich mir mal ein einfaches Plugin für den PHPMailer gemacht.
Dieses nutzt die aktuelle Version des PHPMailer von Github. Sobald das Plugin installiert und aktiviert ist, könnt ihr diesen dann in euren Modulen nutzen. Den Beispielcode müsst ihr natürlich entsprechend eurer benötigten Konfiguration anpassen, der ist jetzt so aus dem Git des PHPMailer übernommen.

Vorraussetzungen
  • CONTENIDO Version 4.10.1
  • PHP >= 8.0
  • Kein anderer PHPMailer installiert

Code: Alles auswählen

$mailer = new PHPMailer(true);

try {
    //Server settings
    $mailer->SMTPDebug = SMTP::DEBUG_SERVER;               //Enable verbose debug output
    $mailer->isSMTP();                                     //Send using SMTP
    $mailer->Host       = 'smtp.example.com';              //Set the SMTP server to send through
    $mailer->SMTPAuth   = true;                            //Enable SMTP authentication
    $mailer->Username   = 'user@example.com';              //SMTP username
    $mailer->Password   = 'secret';                        //SMTP password
    $mailer->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;     //Enable implicit TLS encryption
    $mailer->Port       = 465;                             //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

    //Recipients
    $mailer->setFrom('from@example.com', 'Mailer');
    $mailer->addAddress('joe@example.net', 'Joe User');     //Add a recipient
    $mailer->addAddress('ellen@example.com');               //Name is optional
    $mailer->addReplyTo('info@example.com', 'Information');
    $mailer->addCC('cc@example.com');
    $mailer->addBCC('bcc@example.com');

    //Attachments
    $mail->addAttachment('/var/tmp/file.tar.gz');         //Add attachments
    $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name
    
    //Content
    $mail->isHTML(true);                                  //Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
Für Bugs, Ideen, Wünsche oder Anregungen zum Plugin steht euch ein Ticket-System zur Verfügung.

Mein Git-Repository findet ihr hier :arrow: https://gitport.de/phpBO/phpmailer
Aktuelle Releases und Downloads findet ihr hier :arrow: https://gitport.de/phpBO/phpmailer/releases
Das Ticketsystem findet ihr hier :arrow: https://gitport.de/phpBO/phpmailer/issues

Hoffe ihr könnt das Teil gebrauchen. Freue mich schon auf euer Feedback.

Gruß aus Franken

Ortwin

Re: [Plugins] PHPMailer Plugin for CONTENIDO

Verfasst: Do 25. Jan 2024, 13:30
von Faar
Danke

Re: [Plugins] PHPMailer Plugin for CONTENIDO

Verfasst: Do 25. Jan 2024, 16:41
von bodil
Das hört sich gut an! Wie sich hier die Dinge entwickeln, könnte das demnächst zum Einsatz kommen! Vielen Dank!

Re: [Plugins] PHPMailer Plugin for CONTENIDO

Verfasst: Mo 29. Jan 2024, 12:58
von McHubi
Danke, Ortwin. Habe es mit aufgenommen unter viewtopic.php?f=116&t=43506&p=179642

Re: [Plugin] PHPMailer Plugin for CONTENIDO

Verfasst: Do 22. Feb 2024, 12:27
von Oldperl
Ich danke Dir, Markus. :D

Gruß aus Franken

Ortwin