[TYPO3-dev] swiftmailer and html

Adrien Crivelli adrien.crivelli at gmail.com
Tue Dec 20 04:14:38 CET 2011


Hi,

Not really answering your question, but if that is of any help for you, you
may find a PHP class to convert HTML to plain text over there:
https://svn.typo3.org/TYPO3v4/Extensions/newsletter/trunk/3dparty/class.html2text.inc.
And see this file<https://svn.typo3.org/TYPO3v4/Extensions/newsletter/trunk/Classes/Domain/Model/PlainConverter/Builtin.php>for
an override to make links unique.

Also your code looks fine to me (very similar to the end of this
file<https://svn.typo3.org/TYPO3v4/Extensions/newsletter/trunk/class.tx_newsletter_mailer.php>).
Maybe your $body is was htmlentities()d ? If that's the case your plain
text will also show weird things...



On 13 December 2011 22:12, Thomas Mammitzsch <thomas at visualworx.de> wrote:

> Hi list,
>
> i try to send an hmtl email with swiftmailer. The html part only has some
> text with <br /> tags. Unfortunately the mail doesn't display the breaks
> but the tags. My code looks like that:
>
> $mail = t3lib_div::makeInstance('**t3lib_mail_Message');
> $mail->setFrom(somesender at tld.**com <somesender at tld.com>)
>  ->setTo(somerecipient at tld.com)
>  ->setSubject($subject)
>  ->setBody($body, 'text/html')
>  ->addPart(strip_tags($body), 'text/plain')
>  ->send();
>
>
> SubstituteOldMailApi is set to 1 in the config.
> Would be great if someone can give me a hint.
> ______________________________**_________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>
>



More information about the TYPO3-dev mailing list