We have created a custom payment module to allow integration with a client's POS system. The module delivers the order details in the body of an encrypted plain text email. (This method is determined by the POS, we have no say in the execution.)

The only remaining issue appears to be the content encoding. Because the order details are encrypted, then base64 encoded, we have to protect the integrity of the email content.

The email is sent using Magento's TransportBuilder, but winds up with these email headers and fails decryption.

Rejected email headers:

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0

If I copy the contents into a simple email interface and send as plain text, it is successful with these headers.

Accepted email headers:

Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes
MIME-Version: 1.0
Content-Disposition: inline

What can I do to correct the Content Type and Content Transfer Encoding?

Current code:

protected function prepareMessage()
    $emailTemplate = $this->getTemplate()->loadDefault('ftd_order_email');
    $emailTemplateVariables = $this->templateData['template_process_data'];
    $encryption_key = $this->templateData['encryption_key'];
    $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);

    $encrypted_data = $this->encrypt($encryption_key, self::ENCRYPTION_ALGO, self::ENCRYPTION_MODE, $processedTemplate);

    /** @var AbstractTemplate $template */
    $template = $this->getTemplate()->setData($this->templateData);


    return $this;







$encrypted_data, null, null

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.