Friday, February 16, 2018

Swiftmailer cannot work after upgrade php to 5.5


I'm using SwiftMailer to send email by SMTP. The library is working fine when running in the server with PHP version 5.4. However, after upgrading the server to PHP version 5.5, email was not sent and the server threw the following error:
Undefined property: Swift_Transport_StreamBuffer::$_sequence
How can I resolve this issue? Thanks.

Simple solution:
In swift-mailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php change
 private $_sequence = 0;
to
 protected $_sequence = 0;
Then the message goes away.
I must use a different version of Swiftmailer than you in the legacy project I got the exact same error notice. My Swift::VERSION is 4.1.1.

Source of solution: https://stackoverflow.com/questions/26020949/swiftmailer-error-undefined-property-swift-transport-streambuffer-sequence