Spaces on ends of lines in plaintext version of email

Notice: This thread is very old.

8 years ago

medhi
Bronze Partner | 190
+
0
-

If I send HTML email, then its automatically generated plaintext version has spaces on every end of line.

Don't know if it is bug, but it causes many problems. For example if someone tries to copy password etc.

Thanks.

8 years ago

HosipLan
Moderator | 4693
+
0
-

I think its because it replaces endlines with spaces.

I see the only way as extend the default Message class and override buildText()

class MyMessage extends Nette\Mail\Message
{

	protected function buildText()
	{
		parent::buildText();

		$text = $this->getBody();
		$text = Nette\Utils\Strings::replace($text, '~\s+$~m', "");
		$this->setBody($text);
	}

}

This should remove whitespaces at the end of each line. Hope you can finish this on your own :)