Skip to content

Email Class SMTP Crypto Method Broken / Newline Values Not Saving #2035

Closed
@ShayneSmithZak

Description

@ShayneSmithZak

All email features across my website suddenly stopped working a few months back, this included order confirmations, contact forms, password reset requests, everything. I hadn't updated EE to version 6 because I had concerns with addons not being compatible with the new major version, but when all email across the website broke I decided to run the update. After updating, the issue was still there, so I decided to follow the stack trace and see if there was anything I could fix.

The problem stemmed from the \ee\legacy\libraries\Email.php file, specifically in two lines.
758 $this->newline = in_array($newline, array("\n", "\r\n", "\r")) ? $newline : "\n";
and
1710 $crypto = stream_socket_enable_crypto($this->_smtp_connect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);

The newline value was not being saved in the CMS, so I set it here in code:

//$this->newline = in_array($newline, array("\n", "\r\n", "\r")) ? $newline : "\n"; 
$this->newline = "\r\n";

and I changed the stream crypto method to the most recent version:

// $crypto = stream_socket_enable_crypto($this->_smtp_connect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
$crypto = stream_socket_enable_crypto($this->_smtp_connect, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);

These changes got the email class working again.

The problem now is: if I ever run a CMS update, the newer version will replace this fix and the class will stop working again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: AcceptedBug has been confirmed, is reproducible, and ready to work on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions