---
title: "E-Mail's sind leer"
url: "https://www.typo3.net/d/110620-e-mails-sind-leer"
source: "typo3.net"
tags: ["Extensions","Frage"]
created: "2012-05-15"
last_reply: "2013-02-20"
replies: 4
solved: false
page: 1
pages: 1
lang: "de"
---

# E-Mail's sind leer

Extensions · 4 Antworten · gestartet 2012-05-15

## Eröffnungsbeitrag

**DanyDeluxe** · 2012-05-15 · [Beitrag #1](https://www.typo3.net/d/110620-e-mails-sind-leer/1)

Abend!

Sowohl die Pn-Benachrichtigungs E-Mails als auch die Registrierungs-Mail ist in Outlook und auf t-online.de leer.
Auf Gmx.net wurde 2 Zeilen angezeigt.(Ich kann nicht beurteilen ob auch hier was falsch ist oder das alles ist.)

Betreff wird überall angezeigt.

Hat jemand eine Lösung für diesen Bug?

Gruß,
Daniel

## Antworten

### [#2](https://www.typo3.net/d/110620-e-mails-sind-leer/2) · DanyDeluxe · 2012-05-18

Weis niemand etwas?
Der E-Mail Versand ist auch nicht konstant. Man kommt eine, öfter keine.
De Testmail im Installtool sendet konstant.

Was ich noch vergessen habe: Das Forum ist ein mm_forum in der Version 1.9.1 ;)

Gruß,
Daniel

### [#3](https://www.typo3.net/d/110620-e-mails-sind-leer/3) · jvelletti · 2012-05-29

Hi

wenn GAR nichts verschikt wird, kann das unter anderem am Fehlenden oder falsch definierten "absender" liegen
also den beiden typoscript definitionen:

plugin.mm_forum_pi1.notifyingMail.sender_address = sinnvolles@deinne-domain.xx
plugin.mm_forum_pi1.notifyingMail.sender = Name ohne komische UTF 8 Zeichen ..

ansonsten aus dem Gedächtnis heraus: wird da nicht nur ein Plaintext email verschickt und evt. siehst du deshalb nichts ?

bei uns klappt das nämlich problemlos aber ich hab auch die hjavealook komplett umgebaut .. siehe unten ...

das nachfolgende ist auch nur bedingt anwendbar, da wir z.b. ein eigenes html Email Templete verwenden und auch eine Extension für die Signature integriert haben, aber vielleicht ist das eine Anregung zur Lösung

Grüße
Jörg

```php
 /**
     * Sends an e-mail to users who have subscribed a certain topic.
     *
     * @param  int            $topicId  The UID of the topic about which the users are
     *                                  to be alerted.
	 * @param  tx_mmforum_pi1 $forumObj An instance of the tx_mmforum_pi1 class.
     * @return void
     */
	function notifyTopicSubscribers($topicId, $forumObj) {
		$topicId = intval($topicId);
		
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('topic_title', 'tx_mmforum_topics', 'uid = ' . $topicId  . $forumObj->getStoragePIDQuery());
		list($topicName) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
				
		$sender = $forumObj->conf['notifyingMail.']['sender'];
		if (!preg_match('/<([^><@]*?)@([^><@]*?)>$/',$forumObj->conf['notifyingMail.']['sender'])) {
			$sender = $forumObj->conf['notifyingMail.']['sender'] . ' <' . $forumObj->conf['notifyingMail.']['sender_address'] . '>';
		}

			$Typo3_htmlmail = t3lib_div::makeInstance("t3lib_htmlmail");
			$Typo3_htmlmail->start();
	  		
	  		$Typo3_htmlmail->from_email = $forumObj->conf['notifyingMail.']['sender_address'];
	  		$Typo3_htmlmail->from_name = $forumObj->conf['notifyingMail.']['sender'];
	  		$Typo3_htmlmail->returnPath = $forumObj->conf['notifyingMail.']['sender_address'];
	  		$Typo3_htmlmail->replyto_email = $Typo3_htmlmail->from_email;
	  		$Typo3_htmlmail->replyto_name = $Typo3_htmlmail->from_name;
	  		$Typo3_htmlmail->organisation = "";
	  		$Typo3_htmlmail->priority = 3;

	   
		$template = $forumObj->pi_getLL('ntfMail.text');

		$linkParams[$forumObj->prefixId] = array(
			'action' => 'open_topic',
			'id'     => $topicId
		);

		$link = $forumObj->pi_getPageLink($GLOBALS['TSFE']->id, '', $linkParams);
		$link = $forumObj->tools->escapeBrackets($link);

		if (strlen($forumObj->conf['notifyingMail.']['topicLinkPrefix_override']) > 0) {
			$link = $forumObj->conf['notifyingMail.']['topicLinkPrefix_override'] . $link;
		} else {
			$link = $forumObj->tools->getAbsoluteUrl($link);
		}
		// convert link to HTML Link .. for plain message this tags will be deleted afterwards ...
		$link = "<br>\n<br>\n<a href=\"" . $link . "\">" . $_SERVER['SERVER_NAME'] .  " -> " . $forumObj->pi_getLL('board.rootline') . "</a><br>\n<br>\n" ;
		
		
		//w.f.29.06.11 adding of message and username for the email
		$topicPosterUsername = $GLOBALS['TSFE']->fe_user->user['username'];
		$message = strip_tags($forumObj->piVars['message']);
		
 		$pattern = "|[[\/\!]*?[^\[\]]*?]|si";
 		$replace = "";
 		$message = preg_replace($pattern, $replace, $message);
		
		$marker = array(
			'###TOPICPOSTERUSERNAME###'   => $topicPosterUsername,
			'###POST###'      => $message,
			'###LINK###'      => $link,
			'###TOPICNAME###' => $topicName,
			'###BOARDNAME###' => $forumObj->conf['boardName']
		);

		// get all users on this topic
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'DISTINCT m.user_id, u.email, u.' . $forumObj->getUserNameField(),
			'tx_mmforum_topicmail m, fe_users u',
			'm.user_id = u.uid AND m.topic_id = ' . $topicId .
			' AND u.deleted = 0 AND u.email != "" AND u.disable = 0 AND m.user_id != ' . intval($GLOBALS['TSFE']->fe_user->user['uid']) . $forumObj->getStoragePIDQuery('m')
		);
		
		// get the html Email tempalte		
		$this->templateCode = $forumObj->cObj->fileResource($this->conf["MailTemplateFile"]);
		if (!$this->templateCode ) {
			$this->templateCode = $forumObj->cObj->fileResource("fileadmin/templates_connect/extensiontemplates/mail/mail.html") ;
		}
		// get the singature 
		$html_signature =  tx_nemsignature::getSignature($GLOBALS['TSFE']->sys_language_uid);
		$plain_signature = tx_nemsignature::getSignature($GLOBALS['TSFE']->sys_language_uid, FALSE);
		
		// echo "signature:"  . $html_signature ;
		
						
		// loop through each user who subscribed
		while (list($toUserId, $toEmail, $toUsername) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
			$marker['###USERNAME###'] = $forumObj->escape($toUsername);
			$mailtext = $forumObj->cObj->substituteMarkerArrayCached(nl2br($template), $marker);

			// Compose mail and send
			if (!empty($toEmail)) {
				$llMarker = array(
					'###TOPICNAME###' => $forumObj->escape($topicName),
					'###BOARDNAME###' => $forumObj->escape($forumObj->conf['boardName'])
				);
				$subject = $forumObj->pi_getLL('ntfMail.subject');

				// Include hooks
				if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['newPostMail_contentMarker'])) {
					foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['newPostMail_contentMarker'] as $_classRef) {
						$_procObj = &t3lib_div::getUserObj($_classRef);
						$llMarker = $_procObj->newPostMail_contentMarker($llMarker, $row, $forumObj);
					}
				}
				if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['newPostMail_subject'])) {
					foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['newPostMail_subject'] as $_classRef) {
						$_procObj = &t3lib_div::getUserObj($_classRef);
						$subject = $_procObj->newPostMail_subject($subject, $row, $forumObj);
					}
				}
				$subject = $forumObj->cObj->substituteMarkerArray($subject, $llMarker);
				
				// generate $htmlMail and Plain Message from $mailtext
				$plain_message = strip_tags( str_replace (array("<br>", "<br />", "<br/>", "<BR>", "<BR/>","<BR />","<p>","<P>"), 
															array("\n","\n","\n","\n","\n","\n","\n","\n") , 
															$mailtext ) ."\n\n" . $plain_signature) ;

			
				$emailMarkerArray['###HEADLINE###'] =  $subject;
				$emailMarkerArray['###TEXT###'] =  $mailtext;
				$emailMarkerArray['###IMPRESSUM###'] =  $html_signature;
				$htmlMail = $forumObj->cObj->substituteMarkerArray($this->templateCode, $emailMarkerArray);



				$Typo3_htmlmail->subject = $subject;
				$Typo3_htmlmail->setPlain($Typo3_htmlmail->encodeMsg($plain_message));	
				$Typo3_htmlmail->setHtml($Typo3_htmlmail->encodeMsg($htmlMail));
				$Typo3_htmlmail->fetchHTMLMedia();
	  			$Typo3_htmlmail->substMediaNamesInHTML(0);

	  			$Typo3_htmlmail->setHeaders();
	  			$Typo3_htmlmail->setContent();
	  			$Typo3_htmlmail->setRecipient($toEmail);

				$Typo3_htmlmail->send($toEmail) ;
				
			
			}
		}
	}
```

### [#4](https://www.typo3.net/d/110620-e-mails-sind-leer/4) · Outlaw · 2012-07-27

Wie hier und auch bei mir wird ja was verschickt, halt nur ohne Inhalt ....

Von "gar nichts" kann also nicht die Rede sein.

Gruß
Outi

### [#5](https://www.typo3.net/d/110620-e-mails-sind-leer/5) · jvelletti · 2013-02-20

UPDATE zu meiner Lösung oben :

zum einen die meines Wissens Kopierte Funktion "substituteMarkerArrayCached "
$mailtext = $forumObj->cObj->substituteMarkerArrayCached(nl2br($template), $marker);

ersetzen durch :
substituteMarkerArray
also:
$mailtext = $forumObj->cObj->substituteMarkerArrayCached(nl2br($template), $marker);

oder besser gleich auch auf $Typo3_htmlmail verzichten und die neue Mail API nutzen..

siehe angehängte Datei class.tx_mmforum_havealook.php (renamed to .txt)

class.tx_mmforum_havealook.txt

---

Quelle: „E-Mail's sind leer“, typo3.net, https://www.typo3.net/d/110620-e-mails-sind-leer
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
