[TYPO3-dev] Powermail hook file attachment

Kay Strobach typo3 at kay-strobach.de
Thu Mar 17 17:56:13 CET 2011


Hi David,

i uploaded powermail2document some minutes ago.

It should be visible soon:
http://typo3.org/extensions/repository/view/powermail2document/current/

This extension does what you want.
Please take a look.

Regards
Kay


Am 17.03.2011 17:43, schrieb David ARNOULT - Edition & Internet Operations:
> 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
> 
> 


-- 
http://www.kay-strobach.de - Open Source Rocks




More information about the TYPO3-dev mailing list