[TYPO3-dev] Powermail hook file attachment

David ARNOULT - Edition & Internet Operations d.arnoult at topsolid.com
Thu Mar 17 17:43:27 CET 2011


Hi!

Sorry for my basic level of php but I am trying to develop a hook on
powermail to attach a text file to recipient email. Text file is filled of
marker values from form.
I don't succeed in attaching text file to the email. Hook used is
PM_SubmitEmailHook.
Any hint or idea will be greatly appreciated.

Code:
require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(PATH_t3lib.'class.t3lib_htmlmail.php');

class tx_hookpowermail extends tslib_pibase {
	function PM_SubmitEmailHook($subpart, $maildata, $sessiondata,
$markerArray, $pObj){
		t3lib_div::debug($subpart);
		//t3lib_div::debug($maildata);
		//t3lib_div::debug($markerArray);

		$company = $markerArray['###UID46###'];
		$zip = $markerArray['###UID46###'];
		$city = $markerArray['###UID46###'];
		$email = $markerArray['###UID46###'];
		$siret = $markerArray['###UID46###'];
		$name = $markerArray['###UID46###'];
		$first_name = $markerArray['###UID46###'];
		$tel = $markerArray['###UID46###'];
		$fax = $markerArray['###UID46###'];
		$key1 = $markerArray['###UID46###'];
		$key2 = $markerArray['###UID46###'];

		$file = PATH_site . 'typo3temp/' . $company . '.txt';
		
		$content = $company . "\r\n" . $zip . ', ' . $city . "\r\n"
. $siret . "\r\n" . $name . ', ' . $first_name . "\r\n" . $tel . "\r\n" .
$fax . "\r\n" . $key1 ;
		
		t3lib_div::writeFileToTypo3tempDir($file,$content);
		$this->t3lib_div::addAttachment($file);
		
		/*if ($subpart == 'recipient_mail') {
			$this->addAttachment($file);
		}*/
    return;
  }
}  

Thanks!

David






More information about the TYPO3-dev mailing list