When order confirmation send all content contain this

=0D=0A=0D=0A=0D=0A =0D=0A

Here is email screenshot:

enter image description here


<preference for="\Magento\Sales\Model\Order\Email\SenderBuilder" type="Vendor\Extension\Model\Template\SenderBuilder"/>

Here is Vendor\Extension\Model\Template\SenderBuilder\send.php

Here is my send function for PDF attache

public function send()
        $objectManager = ObjectManager::getInstance();
        $configHelper = $objectManager->get(Data::class);
        if ($configHelper->versionCompare("2.3")) {
            # attach pdf, overide send function
            $attachPdf = $this->attachPDF();
            $copyTo = $this->identityContainer->getEmailCopyTo();
            if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'bcc') {
                foreach ($copyTo as $email) {

            #transport email
            $transport = $this->transportBuilder->getTransport();
            $html = $transport->getMessage();
            $message = Message::fromString($html->getRawMessage());
            $bodyMessage = new \Zend\Mime\Part($message->getBody());
            $bodyMessage->type = 'text/html';
            $bodyMessage->charset = 'utf-8';
            $bodyPart = new \Zend\Mime\Message();
            $bodyPart->setParts([$bodyMessage, $attachPdf]);

            #transport email with body part
        } else {
  • can share code by which you are sending mail? – Padhiyar Gaurang Dec 9 '19 at 13:37
  • 1
    @chirag please share your code, its looks like the headers are changed, please check the header information, and check the encoding type. From the screen shot I can say the encoding is change. =0D is a Carriage Return (CR), =0A is a Line Feed (LF), and =0D=0A is a CRLF combination displays when encoding or any external event happen which cause the change. Please share your code for more debugging – Ashish Ranade Dec 9 '19 at 13:48
  • Hello, @AshishRanade Here add code please check it. – Chirag Gondaliya Dec 9 '19 at 14:06

removing these lines in lib/internal/Magento/Framework/Mail/Message.php

  $part->setEncoding(Mime::ENCODING_QUOTEDPRINTABLE); $part->setDisposition(Mime::DISPOSITION_INLINE);

Other thing is set encoding of message properly. See this method at


public static function encode($str, $encoding, $EOL = self::LINEEND)
    switch ($encoding) {
        case self::ENCODING_BASE64:
            return static::encodeBase64($str, self::LINELENGTH, $EOL);

            return static::encodeQuotedPrintable($str, self::LINELENGTH, $EOL);

             * @todo 7Bit and 8Bit is currently handled the same way.
            return $str;

If your email part message is encoded 'quoted-printable' than it will call encodeQuotedPrintable method which ultimately call private method _encodeQuotedPrintable where line $str = str_replace(static::$qpKeys, static::$qpReplaceValues, $str); replaced those =0D=0A=0D=0A=0D=0A =0D=0A type of strings.

private static function _encodeQuotedPrintable($str)
    // @codingStandardsIgnoreEnd
    $str = str_replace('=', '=3D', $str);
    $str = str_replace(static::$qpKeys, static::$qpReplaceValues, $str);
    $str = rtrim($str);
    return $str;

Where $qpReplaceValues variable values are below. which are current string in your email part.

 public static $qpReplaceValues = [
  • We not found this file lib/internal/Magento/Framework/Mail/Message.php – Chirag Gondaliya Dec 9 '19 at 14:41
  • @ChiragGondaliya Check updated answer. It will help you to understand the problem. – Padhiyar Gaurang Dec 10 '19 at 5:38
  • Now what to do in my code for solution for this issue. – Chirag Gondaliya Dec 10 '19 at 5:46
  • @ChiragGondaliya Set encoding and set disposition setEncoding('base64') and setDisposition('inline') and if that also does not solve than setEncoding('quoted-printable') and setDisposition('inline') – Padhiyar Gaurang Dec 10 '19 at 5:55
  • I try set encoding and disposition but not work. – Chirag Gondaliya Dec 10 '19 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.