[TYPO3-dev] Adding PDF as attachment in div::htmlmail problems.

Steffen Kamper steffen at sk-typo3.de
Mon Jan 7 23:32:56 CET 2008


"Sacha Ligthert" <sacha at ligthert.net> schrieb im Newsbeitrag 
news:mailman.2206.1199740721.5304.typo3-dev at lists.netfielders.de...
> Hello Typo3 folks,
>
> I am coding for my extension again and I want to add a PDF as attachment 
> to a htmlmail instance.
> Upon receiving the mail I can't seem to open a PDF successfully.
>
> Browsing through the code addAttachment() function it can't seem to find 
> the proper mimecode (which is determined by the underlying function) where 
> it diverts to mime type application/octent-stream. Where in the case of 
> PDF it should be application/pdf. Even hacking in the code results in a 
> corrupted PDF file.
>
> Does anybody here know a properway to include PDF files in mailes sent 
> with htmlmail without breaking the PDF?
>
> Greetings,
>
> Sacha Ligthert

this works:

$attachment = PATH_site.'fileadmin/test.pdf';
$htmlmail = t3lib_div::makeInstance('t3lib_htmlmail');
$htmlmail->start();
$htmlmail->subject = $subject;
$htmlmail->from_email = $fromMail;
$htmlmail->from_name = $fromName;
$htmlmail->replyto_email = $htmlmail->from_email;
$htmlmail->replyto_name = $htmlmail->from_name;
$htmlmail->addAttachment($attachment);
 $htmlmail->addPlain($message);
$htmlmail->setHeaders();
$htmlmail->setContent();
$htmlmail->setRecipient(explode(',', $toEMail));
$htmlmail->sendTheMail();

vg  Steffen 






More information about the TYPO3-dev mailing list