Franz Holzinger

Verse of the day

Bei Gott ist mein Heil, meine Ehre, der Fels meiner Stärke; meine Zuversicht ist auf Gott.
Psalm 62:7

© Bible Gateway's Verse of the Day


autor  
8-04-11 12:45:25 html_email
Stefan Schachamayr
Bin Neuling im Forum, kämpfe grade mit html-email-Bestätigungen in tt_products 2.7.1; da es dazu nur wenig Doku gibt zu den Subparts etc. - ist das in dieser Version überhaupt unterstützt? Plain-text funktioniert (aber mit Problemen, wenn z. B. Produkt einen Umlaut enthält) nun habe ich EMAIL_HTML_SHELL eingefügt, und krieg nur ein ? in der E-Mail, weil vielleicht Zeichensatz nicht ok oder sonst ein Fehler. Ratschlag zum debuggen, damit ich Näheres sagen kann?
8-04-11 13:17:02 TYPO3 Version
Franz Holzinger
Welche TYPO3 Version ist das?
Werden die Umlaute im Frontend denn richtig angezeigt?
8-04-11 14:25:42 TYPO3 Version
Stefan Schachamayr
Hallo Franz, danke für die rasche Reaktion
typo3 Version 4.5.2 (mein web-hoster ist da immer vorne dran)
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny10 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
typo 3 5.0.51a
LG Stefan
8-04-11 14:29:42 Umlaute
Stefan Schachamayr
sorry - die Umlaute werden im Frontend super angezeigt (sowohl Warenkorb/Zusammenfassung als auch die Confirmation-Meldung)
8-04-11 14:38:49 Emails in TYPO3 4.5.2
Franz Holzinger
Unter TYPO3 4.5.2 funktioniert der Email Versand leider nicht richtig. Ich habe dazu schon einen Patch vorbereitet. Aber es gibt nun ein weiteres Problem, dass die Bilder in der Email nicht mehr angezeigt werden. Leider habe ich keine Idee, was man da korrigieren muss.

Es hat sich mit dem Swift Mailer einiges geändert und der Email Versand muss in allen TYPO3 Extensions umprogrammiert werden.
8-04-11 14:46:26 Emails
Stefan Schachamayr
Vielen Dank für die klare Antwort. Ich hoffe ich kriege im Text-Plain-Format die Umlaute hin (im Template habe ich sie ja selber in der Hand, aber die Produktbezeichnungen kann ich nicht beeinflussen). freue mich auf den Patch und hoffe, dass er bald verfügbar ist.
13-04-11 11:46:15 Patch zum Swift Mailer für tt_products 2.7.2
Franz Holzinger
diff -rub tt_products-2.7.2-ohne-swift-mailer/ChangeLog tt_products-2.7.2/ChangeLog
--- tt_products-2.7.2-ohne-swift-mailer/ChangeLog 2010-07-07 11:34:54.000000000 +0200
+++ tt_products-2.7.2/ChangeLog 2011-04-12 20:41:41.000000000 +0200
@@ -1,3 +1,4 @@
+ * Fix compatibility break in the HTML emails with Swift Mailer of TYPO3 4.5
* markers for pricesums for each tax rate
* date_of_birth for sr_feuser_register
* gift service
diff -rub tt_products-2.7.2-ohne-swift-mailer/control/class.tx_ttproducts_activity_finalize.php tt_products-2.7.2/control/class.tx_ttproducts_activity_finalize.php
--- tt_products-2.7.2-ohne-swift-mailer/control/class.tx_ttproducts_activity_finalize.php 2011-03-11 11:38:33.000000000 +0100
+++ tt_products-2.7.2/control/class.tx_ttproducts_activity_finalize.php 2011-04-13 08:58:26.000000000 +0200
@@ -42,6 +42,7 @@

require_once (PATH_BE_ttproducts.'lib/class.tx_ttproducts_email_div.php');

+
class tx_ttproducts_activity_finalize {
var $pibase; // reference to object of pibase
var $cnf;
@@ -93,7 +94,7 @@
* @param object $address: tx_ttproducts_info_view
* @return void
*/
- function doProcessing ($templateCode, &$basketView, $funcTablename, $orderUid, &$orderConfirmationHTML, &$error_message, &$address, &$mainMarkerArray) {
+ function doProcessing ($templateCode, &$basketView, $funcTablename, $orderUid, &$orderConfirmationHTML, &$error_message, &$address, $mainMarkerArray) {
global $TSFE;
global $TYPO3_DB;

@@ -101,6 +102,7 @@
$tablesObj = &t3lib_div::getUserObj('&tx_ttproducts_tables');
$markerObj = &t3lib_div::getUserObj('&tx_ttproducts_marker');
$instockTableArray = '';
+ $empty = '';
$recipientsArray = array();
$recipientsArray['customer'] = array();
$emailTemplateArray = array();
@@ -220,7 +229,6 @@
$res = $TYPO3_DB->exec_INSERTquery('fe_users', $insertFields);
// send new user mail
if (count($address->infoArray['billing']['email'])) {
- $empty='';
$emailContent=trim($basketView->getView($empty, 'EMAIL', $address, false, false, false, '###EMAIL_NEWUSER_TEMPLATE###', $markerObj->getGlobalMarkerArray()));
if ($emailContent) {
$parts = explode(chr(10),$emailContent,2);
@@ -301,6 +309,25 @@

// Sends order emails:
$recipientsGroupsArray = array ('shop', 'customer');
+ if ($GLOBALS['TSFE']->absRefPrefix == '') {
+ $absRefPrefix = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+ $markerArray['"index.php'] = '"' . $absRefPrefix . 'index.php';
+ }
+
+ $tmpl = 'BASKET_ORDERCONFIRMATION_TEMPLATE';
+ $customerEmailHTML =
+ $basketView->getView(
+ $empty,
+ 'EMAIL',
+ $address,
+ FALSE,
+ FALSE,
+ TRUE,
+ '###'.$tmpl.'###',
+ $markerArray
+ );
+debug ($customerEmailHTML, 'finalize $customerEmailHTML');
+ $customerEmailHTML = $this->pibase->cObj->substituteMarkerArray($customerEmailHTML, $markerArray);

if ($recipientsArray['customer']) { // If there is a customer as recipient, then compile and send the mail.
$emailContentArray = array();
@@ -308,7 +335,11 @@
$plainMessageArray = array();
$markerArray = array();
$markerArray['###MESSAGE_PAYMENT_SCRIPT###'] = '';
- $empty = '';
+ if ($GLOBALS['TSFE']->absRefPrefix == '') {
+ $absRefPrefix = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+ $markerArray['"index.php'] = '"' . $absRefPrefix . 'index.php';
+ }
+
foreach ($emailTemplateArray as $key => $emailTemplate) {
$emailContentArray[$key] = trim($basketView->getView($empty, 'EMAIL', $address, false, true, $this->conf['orderEmail_htmlmail'], '###'.$emailTemplate.'###', $mainMarkerArray));
if ($emailContentArray[$key]) { // If there is plain text content - which is required!!
@@ -333,6 +364,8 @@
if ($plainMessageArray['shop'] && $this->conf['orderEmail_order2']) {
$recipientsArray['customer'] = array_merge($recipientsArray['customer'], $recipientsArray['shop']);
}
+debug ($recipientsArray, '$recipientsArray Pos 3');
+

$HTMLmailContent = '';
$markerArray = array_merge($mainMarkerArray,$markerObj->getGlobalMarkerArray());
@@ -345,7 +378,7 @@
}
if (class_exists($cls) && $this->conf['orderEmail_htmlmail']) { // If htmlmail lib is included, then generate a nice HTML-email
$HTMLmailShell=$this->pibase->cObj->getSubpart($templateCode,'###EMAIL_HTML_SHELL###');
- $HTMLmailContent=$this->pibase->cObj->substituteMarker($HTMLmailShell,'###HTML_BODY###',$orderConfirmationHTML);
+ $HTMLmailContent=$this->pibase->cObj->substituteMarker($HTMLmailShell,'###HTML_BODY###',$customerEmailHTML);
$HTMLmailContent=
$this->pibase->cObj->substituteMarkerArray(
$HTMLmailContent,
@@ -378,6 +411,7 @@
debug ($fromArray, '$fromArray');

foreach ($recipientsArray['customer'] as $key => $recipient) {
+debug ($recipient, '$recipient');

tx_ttproducts_email_div::send_mail(
$recipient,
diff -rub tt_products-2.7.2-ohne-swift-mailer/lib/class.tx_ttproducts_email_div.php tt_products-2.7.2/lib/class.tx_ttproducts_email_div.php
--- tt_products-2.7.2-ohne-swift-mailer/lib/class.tx_ttproducts_email_div.php 2011-03-11 11:39:18.000000000 +0100
+++ tt_products-2.7.2/lib/class.tx_ttproducts_email_div.php 2011-04-13 08:45:59.000000000 +0200
@@ -46,13 +46,6 @@
class tx_ttproducts_email_div {


- function slashName ($name) {
- $name = str_replace(',' , ' ', $name);
- $rc = '"' . addcslashes($name, '<>()@;:\\".[]' . chr('\n')) . '"';
- return $rc;
- }
-
-
/**
* Extended mail function
*
@@ -65,7 +58,16 @@
* @param [type] $attachment: ...
* @return [type] ...
*/
- function send_mail ($toEMail,$subject,&$message,&$html,$fromEMail,$fromName,$attachment='') {
+ function send_mail (
+ $toEMail,
+ $subject,
+ &$message,
+ &$html,
+ $fromEMail,
+ $fromName,
+ $attachment=''
+ ) {
+ global $TYPO3_CONF_VARS;

debug ($toEMail, 'send_mail $toEMail');
debug ($message, 'send_mail $message');
@@ -73,9 +75,69 @@
debug ($fromName, 'send_mail $fromName');
debug ($html, 'send_mail $html');

+debug ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php'], 'send_mail $TYPO3_CONF_VARS[\'SC_OPTIONS\'][\'t3lib/utility/class.t3lib_utility_mail.php\']');
+ if (
+ isset($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']) &&
+ is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']) &&
+ isset($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) &&
+ is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) &&
+ array_search('t3lib_mail_SwiftMailerAdapter', $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']) !== FALSE
+ ) {
+
+debug ($fromName, 'send_mail $fromName +++ t3lib_mail_Message');
+debug ($toEMail, 'send_mail $toEMail +++ t3lib_mail_Message'); // "Franz Holzinger" <franz@fholzinger.com>
+
+debug ($html, 'send_mail $html +++ t3lib_mail_Message');
+
+debug ($GLOBALS['TSFE']->renderCharset, '$GLOBALS[\'TSFE\']->renderCharset');
+
+// $csConvObj = &$GLOBALS['TSFE']->csConvObj;
+// $html = $csConvObj->conv($html, $GLOBALS['TSFE']->renderCharset, 'iso-8859-1');
+//
+// debug ($html, 'send_mail $html iso-8859-1 t3lib_mail_Message');
+
+ /** @var $mail t3lib_mail_Message */
+ $mailMessage = t3lib_div::makeInstance('t3lib_mail_Message');
+ $mailMessage->setTo($toEMail)
+ ->setFrom(array($fromEMail => $fromName))
+ ->setSubject($subject)
+ ->setBody($html, 'text/html', $GLOBALS['TSFE']->renderCharset);
+
+ // ->addPart($message, 'text/plain', 'iso-8859-1');
+
+/*
+ if ($html != '') {
+ $mailMessage->setBody($html, 'text/html', 'iso-8859-1');
+ } else if ($message != '') {
+ $mailMessage->addPart($message, 'text/plain', 'iso-8859-1');
+ }*/
+
+ if (isset($attachment)) {
+ if (is_array($attachment)) {
+ $attachmentArray = $attachment;
+ } else {
+ $attachmentArray = array($attachment);
+ }
+ foreach ($attachmentArray as $theAttachment) {
+ if (file_exists($theAttachment)) {
+ $mailMessage->attach(Swift_Attachment::fromPath($theAttachment));
+ }
+ }
+ }
+ if ($bcc != '') {
+ $mailMessage->addBcc($bcc);
+ }
+ $mailMessage->send();
+ } else {
include_once(PATH_t3lib.'class.t3lib_htmlmail.php');
- $fromName = self::slashName($fromName);
-debug ($fromName, 'send_mail $fromName Pos 2');
+ $fromName = tx_div2007_alpha5::slashName($fromName);
+ debug ($fromName, 'send_mail $fromName Pos 2');
+
+ if (is_array($toEMail)) {
+ list($email, $name) = each($toEMail);
+ $toEMail = tx_div2007_alpha5::slashName($name) . ' <' . $email . '>';
+ }
+
$cls=t3lib_div::makeInstanceClassName('t3lib_htmlmail');

if (class_exists($cls)) {
@@ -145,6 +207,7 @@
}
}
}
+ }


/**
diff -rub tt_products-2.7.2-ohne-swift-mailer/model/class.tx_ttproducts_category.php tt_products-2.7.2/model/class.tx_ttproducts_category.php
--- tt_products-2.7.2-ohne-swift-mailer/model/class.tx_ttproducts_category.php 2011-03-09 17:38:04.000000000 +0100
+++ tt_products-2.7.2/model/class.tx_ttproducts_category.php 2011-04-13 08:40:30.000000000 +0200
@@ -445,8 +445,9 @@
$category = $this->get($actItem['rec']['category']);
$tmp = $emailObj->getEmail($category['email_uid']);
if ($tmp) {
- $emailArray[$actItem['rec']['category']] = tx_ttproducts_email_div::slashName($tmp['name']) . ' <' . $tmp['email'] . '>';
+ $emailArray[$actItem['rec']['category']] = array($tmp['email'] => $tmp['name']);

+// tx_div2007_alpha5::slashName($tmp['name']) . ' <' . $tmp['email'] . '>';
}
}
}
diff -rub tt_products-2.7.2-ohne-swift-mailer/view/class.tx_ttproducts_article_base_view.php tt_products-2.7.2/view/class.tx_ttproducts_article_base_view.php
--- tt_products-2.7.2-ohne-swift-mailer/view/class.tx_ttproducts_article_base_view.php 2010-06-03 14:57:36.000000000 +0200
+++ tt_products-2.7.2/view/class.tx_ttproducts_article_base_view.php 2011-04-12 20:54:45.000000000 +0200
@@ -193,7 +193,7 @@

// Get image
if (isset($row['delivery'])) {
- $imageObj->getSingleImageMarkerArray ($this->marker.'_DELIVERY', $markerArray, $this->conf['delivery.'][$row['delivery'].'.']['image.']);
+ $imageObj->getSingleImageMarkerArray ($this->marker.'_DELIVERY', $markerArray, $this->conf['delivery.'][$row['delivery'].'.']['image.'], $theCode);
} else {
$markerArray['###'.$this->marker.'_DELIVERY###'] = '';
}
diff -rub tt_products-2.7.2-ohne-swift-mailer/view/field/class.tx_ttproducts_field_image_view.php tt_products-2.7.2/view/field/class.tx_ttproducts_field_image_view.php
--- tt_products-2.7.2-ohne-swift-mailer/view/field/class.tx_ttproducts_field_image_view.php 2009-03-24 19:50:10.000000000 +0100
+++ tt_products-2.7.2/view/field/class.tx_ttproducts_field_image_view.php 2011-04-12 20:57:50.000000000 +0200
@@ -58,8 +58,8 @@
} // init


- function getSingleImageMarkerArray ($markerKey, &$markerArray, &$imageConf) {
- $tmpImgCode = $this->cObj->IMAGE($imageConf);
+ function getSingleImageMarkerArray ($markerKey, &$markerArray, &$imageConf, $theCode) {
+ $tmpImgCode = $this->getImageCode($imageConf, $theCode);
$markerArray['###'.$markerKey.'###'] = $tmpImgCode;
}

diff -rub tt_products-2.7.2-ohne-swift-mailer/view/field/class.tx_ttproducts_field_media_view.php tt_products-2.7.2/view/field/class.tx_ttproducts_field_media_view.php
--- tt_products-2.7.2-ohne-swift-mailer/view/field/class.tx_ttproducts_field_media_view.php 2011-04-07 13:36:05.000000000 +0200
+++ tt_products-2.7.2/view/field/class.tx_ttproducts_field_media_view.php 2011-04-12 21:00:10.000000000 +0200
@@ -39,6 +39,19 @@
class tx_ttproducts_field_media_view extends tx_ttproducts_field_base_view {


+ function getImageCode ($imageConf, $theCode) {
+ $imageCode = $this->cObj->IMAGE($imageConf);
+
+ if ($theCode == 'EMAIL' && $GLOBALS['TSFE']->absRefPrefix == '') {
+ $absRefPrefix = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+ $fixImgCode = str_replace('index.php', $absRefPrefix . 'index.php', $imageCode);
+ $fixImgCode = str_replace('src="', 'src="' . $absRefPrefix, $fixImgCode);
+ $imageCode = $fixImgCode;
+ }
+ return $imageCode;
+ }
+
+
/**
* replaces a text string with its markers
* used for JavaScript functions
@@ -205,7 +218,7 @@
$this->cObj->alternativeData = ($meta ? $meta : $imageRow);
$imageConf['params'] = preg_replace('/\s+/',' ',$imageConf['params']);
$this->replaceMarkerArray($markerArray, $imageConf, $this->cObj->alternativeData);
- $tmpImgCode = $this->cObj->IMAGE($imageConf);
+ $tmpImgCode = $this->getImageCode($imageConf, $theCode);
if ($tmpImgCode != '') {
$imgCodeArray[$key] .= $tmpImgCode;
}
@@ -219,7 +232,7 @@
$theImageConf = array_merge($imageConf, $specialImageConf);
$this->cObj->alternativeData = ($meta ? $meta : $imageRow); // has to be redone here
$this->replaceMarkerArray($markerArray, $theImageConf, $this->cObj->alternativeData);
- $tmpImgCode = $this->cObj->IMAGE($theImageConf);
+ $tmpImgCode = $this->getImageCode($theImageConf, $theCode);
$key1 = $key.':'.$specialConfType;
$imgCodeArray[$key1] .= $tmpImgCode;
}
@@ -229,7 +242,7 @@
$imageConf = $this->conf[$imageRenderObj.'.'];

$imageConf['file'] = $this->conf['noImageAvailable'];
- $tmpImgCode = $this->cObj->IMAGE($imageConf);
+ $tmpImgCode = $this->getImageCode($imageConf, $theCode);
$imgCodeArray[0] = $tmpImgCode;
}
return $imgCodeArray;
< Zurück zum Forum