how to remove email server?

letters sent to mail, the server domain, remain on the server, but it is necessary to go to the yandex.ru server, because mail for the domain with mx.yandex.ru is connected. Or can it be more correct to change the MX record of the server domain on the server to mx.yandex.ru? how to do it?

or disable the email server so that nothing goes through Dovecot. Now letters to the address matching the server address are sent via Dovecot, i.e. remains on the server (((, but it is necessary to leave like all other letters to the server yandex.ru

the picture shows that if the recipient is xxxx@yandex.ru or another, then in the line “realay = mx.yandex.ru”, and if the recipient is xxxx@oksgem.ru then “realay = dovecot”. it is necessary to always have realay = mx.yandex.ru. Otherwise, in the second case, the letters do not leave the server, but remain in the internal mail (((.

please help quickly!