We're experiencing difficulty. Our engineers are on it. Please check status.mailgun.com for real-time updates.

Where Can I Find My API Key and SMTP Credentials?

Authentication is required any time you wish to relay messages through our platform. When using our API, you need to use one of your account's API keys (either the primary account API key or one of your Domain Sending Keys).

For our SMTP server, you need to use your domain's SMTP credentials.

Note: If the API keys are not visible within your Control Panel, verify your permissions with your account's Admin user.

API Keys

Primary Account API Key

When you sign up for Mailgun, we generate a primary account API key. This key allows you to perform all CRUD operations via our various API endpoints and for any of your sending domains.

To view your API key:

  1. Navigate towards the top-right of the page next to your username, click the down-arrow, and then select the API Keys option. Alternatively, you can use this direct link
  2. Click on the eyeicon to make the full API key visible.

Domain Sending Keys

Domain Sending Keys are API keys that only allow sending messages using a POST call via our /messages and /messages.mime endpoints for the domain in which they are created for. In order to create a sending API key:

  • Click on the Sending drawer on the left-hand side of the Mailgun dashboard
  • Click on Domains, select the domain in which you wish to add a sending key to
  • Click on Domain Settings and navigate to the Sending API keys tab
  • Click on Add Sending Key
  • Give your key a suitable description (such as the name of the application or client you're creating the key for) and click Create Sending Key
  • Copy your sending API key and keep it in a safe place. For security purposes, we will not be able to show you the key again. If you lose your key, you will need to create a new key.
Note: Once you add a new Domain Sending Key, they are ready to be used immediately, and do not affect usage of your primary API key.

SMTP Credentials

Your SMTP credentials are different for each domain you add. You can find your default credentials, and add more, by clicking through to your domain settings.

Inside the Mailgun Control Panel (options displayed down the left-hand side on a dark column), the SMTP Credentials are not visible and can only be reset.  To update your SMTP credentials, use the following instructions:

  • Click on Sending on the left-hand side of your Mailgun dashboard and select Domains.
  • Select your desired domain.
  • Click on Domain Settings, then click on the SMTP credentials tab.
  • To update the password click Reset Password.
  • Confirm your password reset by clicking Reset Password in the pop-up.
  • The new SMTP password will be available within a dark-gray notification window that appears in the bottom-right portion of the Control Panel. Save this password by clicking on the copy button and pasting it into your application and a secure password manager, as it will not be displayed again.

What Ports Does Mailgun Support?

Our servers listen on ports 25, 465 (SSL/TLS), 587 (STARTTLS), and 2525.

A few things to note when selecting a port:

  • Some ISPs block or throttle SMTP port 25. We recommend using port 587 instead.
  • Google Compute Engine allows port 2525 for SMTP submission.
  • Mailgun IPs change frequently, we do not recommend setting up firewall restrictions against our IP addresses.
  • See our SMTP documentation in the users manual to learn how to configure the most popular SMTP software and email clients to work with Mailgun.

For a more detailed explanation on ports check out our blog post.


If any questions arise, just reach out to our Support team via the Support tab in your Mailgun control panel!