moudsen / mailGraph

Zabbix Media module and scripts for sending templated e-mail alerts enriched with multiple configurable graphs and associated event information
MIT License
32 stars 5 forks source link

Replace swiftmailer/swiftmailer with symphony/mailer #36

Closed moudsen closed 1 year ago

moudsen commented 1 year ago

The swiftmailer/swiftmailer repository under composer has been abandoned. New library suggested is symphone/mailer.

moudsen commented 1 year ago

Initial thoughts using Mailer is a required refactoring of the mailGraph code to adopt Mailer. The current as-is code cannot be migrated by replacing the library only.

This will require a bit more time and testing than expected hence taking a crack at it a a later moment.

moudsen commented 1 year ago

Deprecation messages are appearing while debug logging for mailGraph is enabled. These messages can be safely discarded as notice and will disappear with the replacement of SwiftMailer by Mailer.

moudsen commented 1 year ago

https://symfony.com/doc/current/mailer.html#installation

moudsen commented 1 year ago

Deprecation messages are now also thrown from PHP 8.x perspective. Replacement eminent - will update on short notice to complete the deprecation lead updates required to get to a clean state again.

moudsen commented 1 year ago

Found some severe restrictions in using Symfony Mailer such as attaching/defining an attachment from memory. Considering PHPMailer as a replacement.

moudsen commented 1 year ago

Runs perfectly with PHPMailer. Abandoning Symfony from here.

composer require phpmailer/phpmailer

Comments:

Next steps:

moudsen commented 1 year ago

Considering abandoning the plain text output variant and use HTML only.

moudsen commented 1 year ago

https://informationarchitect.pl/fixed-phpmailer-and-smtp-with-ssl-issues/

moudsen commented 1 year ago

Template update required for html: adding "cid:" for every graph source (Swift did this for me, PHPMailer does not. Considering to tackle otherwise in the code instead of the template.

moudsen commented 1 year ago

Found a solution - no template change required :-). Content-id marker is now added after processing of the image attachment to the message.

moudsen commented 1 year ago

Depending on AutoTLS now - removing encryption configuration from config file.

moudsen commented 1 year ago

Error catching complete

moudsen commented 1 year ago

Testing and final adjustments completed. Considering to release v.212 after final code review.

moudsen commented 1 year ago

Found different curl behavior with PHP 8.2: cookies are automically removed after a session. Adjusted coding accordingly. Final testing rounds on Zabbix 5.4 and Zabbix 6.0 LTS in progress.

moudsen commented 1 year ago

Testing completed successfully. Committed as v2.12