Are you running macOS Server here, and your own Postfix and Dovecot servers?
For most of the rest of this reply, I'm going to assume you're not running Server...
If I've assumed incorrectly, and you are running macOS Server, which version of Server.app?
If you're posting your question here because you saw "server" in the topic and thought it related to the mail server(s) you're using, and you're not running macOS with Server.app installed and not running the older OS X Server software, then start with the Connection Doctor within Mail.app, and then with the Apple mail troubleshooting information for sending mail.
Mail has two sets of settings and two sets of server information and two sets of login credentials for each mail account. One for reading and receiving mail via POP or IMAP, and a separate set of settings for sending mail via SMTP or ESMTP. If you're having trouble sending, you'll want to check the SMTP or ESMTP credentials, ports, security, and related settings specifically.
And you'll also need to compare your settings with those required by your particular mail provider.