This configuration is for mailgun which I am using to enable email notifications on this blog, I also have used SMTP2GO API as another recommended solution for enabling email on domain.

This is for the SMTP verification model using Swaks, assumption on this is you are using Ubuntu 14.04 or higher

Install Swaks

curl http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks -o swaks

Set the binary to be executable

chmod +x swaks

Install perl dependencies if needed

sudo apt-get -y install perl

Send the test email, fill in the details

./swaks --auth --server smtp.mailgun.org --au postmaster@<your_domain> --ap <your_mailgun_smtp_password> --to <target_email_address> --h-Subject: "Hello" --body 'Mailgun SMTP test email service'

This is a sample response that

=== Trying smtp.mailgun.org:25...
=== Connected to smtp.mailgun.org.
<-  220 ak47 ESMTP ready
...
 -> Date: Fri, 14 Dec 2018 10:29:00 -0600
 -> To: target_email_address
 -> From: robin@wasp.localdomain
 -> Subject: Hello
 -> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/
 ->
 -> Mailgun SMTP test email service
 ->
 -> .
<-  250 Great success
 -> QUIT
<-  221 See you later. Yours truly, Mailgun
=== Connection closed with remote host.