So far I used the following to make sure special charakters where correctly shown in the mail subject:
<?php $subject = '=?utf-8?B?' . base64_encode($subject) . '?='; ?>
But with very long subjects, the header line gets longer than 76 chars and some e-mail servers really don't like that... So this is my new solution:
<?php $subject = substr(mb_encode_mimeheader("Subject: " . $subject, 'utf-8', 'B', "\r\n", 0), 9); ?>
Please note: I added "Subject: " in front of $subject and stripped it of afterwards. This is to make sure, that the necessarry space is reserved, as PHP will add the "Subject: " itself...