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 https://support.apple.com/en-ie/guide/mail/cpmlprefcomp/13.0/mac/10.15
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
Read Send email in Mail on iPad - Apple Support
Send an email from a different account
If you have more than one email account, you can specify which account to send email from.
Tap the From field to choose an account.
Set up an automatic reply in Mail on iCloud.com - Apple Support
If you can’t send emails on your iPhone, iPad or iPod touch – Apple Support