Why do you want to restore the mail sender configuration at all ?
Typically the way I work this out is that our preprod environments MAIL_SENDERS are all set with no Host so that no email ever goes out. If I need to test very specific email functionality, I create a NEW mail_sender with credentials, which is NOT the default mail sender, and then I test using that new mail sender.
So effectively, the default mail sender always stays disabled through no Host, and never ends up sending any emails at all. (The app Messages stay failed in the queue and remain failed forever).
I’d suggest removing or entering a bogus/invalid SMTP server in the MAIL_SENDER configuration.
That way all messages will actually process but fail, and should not retry/resume if you ever do want to configure it correctly to test something for a short time.
Thanks @SimonTestard, I will do this. Create another sender for testing is a great idea.
I will create another mail sender, the default one will be always with a bad setting and I will use the new one if needed for the tests.
@NickPorter, if you restore SMTP server to do testing emails remain in the queue will be sent.
@NickPorter, if you restore SMTP server to do testing emails remain in the queue will be sent.
No, I don’t think so. The idea is that you configure it such that the sending of emails actually fails - i.e. the outbound messaged go into FAILED or ERROR status, and these will not retry. If you just configure it so the MAIL_SENDER doesn’t run, but the messages still queue up (WAITING state or equivalent), then it would indeed send the backlog after setting up valid info.