Option 1 :
Try to send email with sand box server and check for the following setting by:
Log in to the Cloud Control Panel by using your Rackspace Cloud account credentials.
At the top of the panel, click the Rackspace Cloud menu and then select Mailgun.
Your account synchronizes with Mailgun, and the Mailgun Control Panel opens.
(Optional) Send a test email by using the sandbox that Mailgun provides you.
Option 2:
First Check for the following settings :
Sending emails via SMTP Library
Integration with Mailgun programatically is available from languages with an SMTP library. Let's take a look at a trivial Python script that instructs Mailgun to send an email through SMTP. We will leverage the smtplib library available natively in Python.
https://www.rackspace.com/knowledge_center/article/introduction-to-mailgun-email-automation
Best,