\Zend\Mime\Mime::LINEEND causes problems with some SMTP-Servers #2918

Closed
maximilian-walter opened this Issue Nov 8, 2012 · 2 comments

Projects

None yet

2 participants

@maximilian-walter

The constant "\Zend\Mime\Mime::LINEEND" sets line-breaks to "\n" instead of "\r\n". This causes problems with some SMTP-servers, eg with 1and1. If I add a base64-encoded attachment, I get the following error:

500 Line limit exceeded

If I change the constant to "\r\n" like defined in the RFC, the mail can be send. My assumption is that 1and1 ignores the "\n", so the complete attachment is one line which is too long.

The \Zend\Mail\Message-class uses \Zend\Mime\MimePart::getContent() and passes the correct EOL, but it is only used on non-streams:

public function getContent($EOL = Mime::LINEEND)
{
    if ($this->isStream) {
        // getEncodedStream() doesn't use $EOL, why?
        return stream_get_contents($this->getEncodedStream());
    }
    return Mime::encode($this->content, $this->encoding, $EOL);
}

Possible solutions: Modify \Zend\Mime\MimePart::getEncodedStream() so it uses the passed $EOL, or the constant can be changend to "\r\n".

@Maks3w
Member
Maks3w commented Nov 16, 2012

I agree with add an optional $EOL argument to getEncodedStream()

Can you send us a patch with the fix to develop branch?

@Maks3w Maks3w was assigned Nov 16, 2012
@Maks3w
Member
Maks3w commented Nov 16, 2012

merged, thank you @maximilian-walter

@Maks3w Maks3w closed this Nov 16, 2012
@gianarb gianarb pushed a commit to zendframework/zend-mime that referenced this issue May 15, 2015
Maximilian Walter Zend\Mime\Part::getEncodedStream() did not use correct EOL (Issue zen… 3d5df17
@gianarb gianarb pushed a commit to zendframework/zend-mime that referenced this issue May 15, 2015
@Maks3w Maks3w Merge pull request zendframework/zendframework#2985 from maximilian-w…
…alter/develop

Zend\Mime\Part::getEncodedStream() did not use correct EOL (Issue zendframework/zendframework#2918)
31d535b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment