I’m trying to do the same thing, but struggling to work out exactly how to do this part.
I presume I need to selectively tell Injector to use either Swift_Transport_user1 or Swift_Transport_user2 class instead of SilverStripe\Control\Email\Mailer, at the point of sending the email? But I can only find instructions for how to do within the yml file.
I’m curious about this too. I guess you would have to use the Config API since Email::send() uses Injector to grab a Mailer, so you can’t directly access it from an Email object. Not sure of the equivalent PHP but I think you would need to effectively change it to:
then send you email, then revert it back to whatever it was.
BTW, this is more for the OP than you and might not work for your use case, but if you are able to use a transactional email product like MailGun or PostMark, those typically let you send from any email address on a domain you have verified. The Username is incidental - it might be an email address or an API key, but the email is sent from whetever you specify in $email->setFrom(). So normally in that setup, one Transport is enough.