It would be nice to have the ability to alter the instantiated Swift_Mailer object. atm if you need to allow self-signed certificates, you'll need to subclass the Swiftmailer plugin and duplicating a lot of code, just for adding a single line (see #2948343: Change private methods to protected in SwiftMailer class for example). Firing an event with the Swift_Mailer instance attached would allow custom or contrib modules to do any modification to that instance or it's attached transport instance, etc.

Of course we can further think of offering the various SSL stream options as configuration settings for the smtp transport. However having this alteration option would make things massively more flexible and help in many other use cases as well

Comments

agoradesign created an issue. See original summary.

webflo’s picture

Did you try to alter the $mailer in hook_swiftmailer_alter?

agoradesign’s picture

I guess, I have completely overseen this alter hook. I'll have a look and report back

agoradesign’s picture

Status: Active » Closed (works as designed)

I'll close it now. I didn't try it out, but had a looked at the module's source code - the hook definition as well as the place where it is called. My use case should be definitely covered by that. Thanks!