With 2 Outgoing Mail Servers, how can a plugin pick one over the other to send email

Hi,

I am writing a plugin that requires emails to be sent to a list of external emails (like a mail-out service). These external emails do not belong to users of Confluence.

The requirement is to make the emails sent to these external email addresses look like they come from a support account, not from the default confluence account that our confluence users currently see.

For this, I have set up a second outgoing Mail Server with a new and different FROM email.

My problem is, that I have no way of picking this Mail Server from the list of mail servers when adding mail to the mail TaskManager. Using the prescribe method: Preparing for Confluence 7.0 | Confluence Data Center and Server 8.4 | Atlassian Documentation

I’m sure this must be possible, using the test email feature of the Mail Server configuration allows this, by specifying the mail server id…

So, why isn’t there a Java API available for this?

Do we specify a queue other than “mail” or somehow selecting which MailServer to send the email with. This seems like such a simple option, however I can’t find anything on how this might be done.

Does anyone know how this can be done?

Did you ever figure this out?
I’m trying to figure out if our server or a plugin (confiforms) has a bug.
We can send mail directly with chosen smtp server, but when using email queue it does not seem to be able to choose the right smtp server when using the mail queue.