I'm using the PHP Swiftmailer package and was looking for a way to use multiple SMTP servers. I found the Swift LoadBalance Transport and from what I read this would round robin between SMTP connection. However, I have two SMTP servers with each one is running a different mailserver domain. Is there a way to change the ->setFrom(MAIL_FROM) based on the SMTP server transport instance being used?
It should be pretty easy with a plugin handling 'beforeSendPerformed' event (you could base it on ImpersonatePlugin). It receives Swift_Events_SendEvent, from which you could get both transport being used to send the message and the message itself, so you could modify the originating address accordingly.
Weirdan wrote:It should be pretty easy with a plugin handling 'beforeSendPerformed' event (you could base it on ImpersonatePlugin). It receives Swift_Events_SendEvent, from which you could get both transport being used to send the message and the message itself, so you could modify the originating address accordingly.
Thank you very much. Starting to understand how to approach this, the only question I have is how would I get the transports being used to send the message.