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. We'll show you how to do this below:
- First, log in to the Mailgun Control Panel (if you have not already done so).
- Then, at the top-right corner of the page, click the Profile drop-down menu to expand its list of options.
- Next, click the API keys option. Alternatively, you can use this direct link.
- Click the eye icon 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. We'll show you how to do this below:
- First, log in to the Mailgun Control Panel (if you have not already done so).
- Then, within the left-hand navigation pane, click the Sending option to expand its list of sub-options.
- Next, click the Domain settings suboption, and then click on the Sending API keys tab.
- Click the Add sending key button.
- In the pop-up modal, enter a suitable description (such as the name of the application or client you're creating the key for) before finally clicking the Create sending key button.
- 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 any currently added users, and add more, by clicking through to your domain settings. We'll show you how to do this below:
- First, log in to the Mailgun Control Panel (if you have not already done so).
- Then, within the left-hand navigation pane, click the Sending option to expand its list of suboptions.
- Next, click the Domain settings suboption, and then click on the SMTP credentials tab.
- To update the password, click the Reset password button.
- Confirm your password reset by clicking the Reset Password button in the pop-up modal.
- NOTE: 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 in your application and in a secure password manager, as it will not be displayed again.
Want to create SMTP credentials using the Domain API? Review this documentation.
Need to shorten or otherwise customize your SMTP password? Check out this article!
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 of ports check out our blog post.
Got Questions?
Mailgun by Sinch has answers! If you have any concerns or questions, please send us a Support ticket using the Support page within your Mailgun Control Panel. Our Support Team will be happy to assist!