If your iCloud account is not connected ( just an example ) , open mail application click on I cloud and send a mail from - iCloud address ( in the To - field type your gmail address ) the mail will be sent to your inbox in your apple mail application a pop up appears , in this screen shot it is showing could not connect to outgoing server , thats the reason when connection doctor is opened SMTP for iCloud is totally vanished .You can apply same with gmail say if IMAP or SMTP is not working . Simply click on always use this server to get joined .
And you will observe all IMAP / SMTP for gmail account and iCloud account are showing green dots and joined to their respective server .
Compose a mail ( use command and N keys ) , fill up the credentials select a different mail address and click on try with selected server , in fact in mail preferences send new messages is automatic , that's the reason see the article Change Composing preferences in Mail on Mac - Apple Support (IE)
Send new messages from .
The email address to use when you send messages.
If you use several email accounts, you can have Mail automatically select the best address, based on the email address of the first recipient in your message, as well as the currently selected mailbox and message.
You can click on drop down arrow and choose the desired mail address like example1@icloud.com