php-Script e-mail Versand von mail() auf SMTP ändern
Hallo zusammen,
in einer contao Installation wird der Mail-Versand derzeit über die php-Mail-Funktion erledigt mit
Code:
mail($email, $betreff, $mailText, $header);
Das Ganze muss über ein php-Script laufen, weil die übergebene Daten gleichzeitig in eine externe DB eingetragen werden.
Kann mir jemand Tipps geben wie ich das per SMTP versenden kann?
Ist phpmailer benutzen eine gute Möglichkeit? (Für Frontendler ;))
Viele Grüße,
conter
swiftmailer: E-mail mit insert-tags versenden klappt nicht
Hallo zusammen,
ich habe meine HTML-Mail jetzt erfolgreich zusammengebaut und möchte jetzt Textbausteine aus contao per Inserttags verwenden.
Im alten Script hat
Code:
$formTextHeader = $this->replaceInsertTags('{{insert_article::107}}');
funktioniert.
Mit meinem Swiftmailerscript funktioniert es nur als echo-Ausgabe also
und
geben die Inhalte aus dem contao article korrekt wieder.
Beim Versenden mit $formTextHeader-insert von oben kommt folgender Fehler:
Code:
[2021-11-12 16:41:04] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Failed to start the session because headers have already been sent by "/var/www/clients/client3/web356/web/web/v1/vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php" at line 160." at /var/www/clients/client3/web356/web/web/v1/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 152 {"exception":"[object] (RuntimeException(code: 0): Failed to start the session because headers have already been sent by \"/var/www/clients/client3/web356/web/web/v1/vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php\" at line 160. at /var/www/clients/client3/web356/web/web/v1/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:152)"} []
[2021-11-12 16:41:04] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Error when rendering "https://www.domain.de/_fragment?_hash=YME8XsY6D6zYy5eg3J7%2BwrIi%2B7tTBL8mEtvQDcwUeO8%3D&_path=insertTag%3D%257B%257Bua%253A%253Aclass%257Cattr%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=900&pageId=171&request=testbuchen-feedback" (Status code is 500)." at /var/www/clients/client3/web356/web/web/v1/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php line 99 {"exception":"[object] (RuntimeException(code: 0): Error when rendering \"https://www.domain.de/_fragment?_hash=YME8XsY6D6zYy5eg3J7%2BwrIi%2B7tTBL8mEtvQDcwUeO8%3D&_path=insertTag%3D%257B%257Bua%253A%253Aclass%257Cattr%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=900&pageId=171&request=testbuchen-feedback\" (Status code is 500). at /var/www/clients/client3/web356/web/web/v1/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php:99)"} []
Wenn ich die Variable $formTextHeader = "Mein statischer Textheader"; nehme, wird die Mail korrekt verschickt
Kann mir jemand helfen, die inserts auch mit zu versenden?
Viele Grüße,
conter