Your query is not clear
If you are creating an MTA to send mails to outside world
There are a few things to keep in mind
1. If you send the mail as-if appearing from your system, most of the SMTP mail servers will reject your mail
as the mail server from which mail is originating must
a) have a static ip address
b) must be reverse-resolveable by name.
However, you can ask your service provider to give you an smtp server to which you can do a smart-host transfer
If you are trying to send mails locally, internally to systems:
Just by adding the host name in the hosts file and sending mail
abc@host.dom will not work.
The mx record for the domain/host must be resolve'able.
You might want to take a look at the SMTP RFC to understand more and also read-up on DNS MX records.