Are you looking to send emails through the server directly ? You should never do that. Instead, you first need to choose an SMTP provider (mailgun, postmark etc) and then use a WOrdPress plugin that can use that SMTP. I highly suggest using this one :
https://wordpress.org/plugins/wp-mail-smtp/