Clearer set-up documentation
Description
With the set-up instructions it would be great if it could clearly communicate:
- which Mailgun API key to use (Private or Public)
- what (or how to access) the required 'Endpoint' - not obvious from the Mailgun dashboard?
Just a follow-up on this as I also struggled to figure out what was needed.
Domain
Add the URL without https:// e.g. website.com
API Key Get this from Mailgun via Sending > Domains > YOUR_DOMAIN_NAME > Domain Settings (You might need to open 'Sending' again in the sidebar) > Sending API Keys
In there create a new API key
Endpoint This was the tricky bit for me! As I couldn't find it ANYWHERE, but luckily checking out Mailgun's docs I found:
https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages
But if your using EU location use:
https://api.eu.mailgun.net/v3/YOUR_DOMAIN_NAME/messages
Storing these all as env vars in the .env works a treat also and more secure, like:
MAILGUN_DOMAIN="website.com"
MAILGUN_API_KEY="1a2b3c4d5e6f7g8h9i0j"
MAILGUN_ENDPOINT="https://api.mailgun.net/v3/website.com/messages"
Would be good if this was in the docs so it didn't waste time digging around to find this though!
Thats great thanks Jason.
Out of curiosity with the domain part did you include the 'mg' segment that Mailgun adds?
mg.website.com
or just
website.com
@mattias78 I didn't, I think the Domain is just how you add the domain in Mailgun. I suppose if you've added it with a subdomain (It suggests doing this doesn't it) then you would add it in. But we don't add any subdomains on.
Thanks for this info - I was having trouble too. Worth noting that if you're using the sandbox domain for testing, the test will only work if you add yourself as an Authorised Recipient in Mailgun
Thanks for the instructions!
It was the mailgun endpoint that had me stumped for a while. If you're using the EU location this needs to be set to https://api.eu.mailgun.net - leaving this field empty or using https://api.mailgun.net doesn't work.
Definitely worth P&T doing a quick update of the docs/readme.
Thanks for your help everyone above, but none of that was working for me. What did work for me was:
MAILGUN_DOMAIN="m.website.com"
MAILGUN_API_KEY="key-XXXXXXXXXXXXXXXXXXXXXXXXX"
MAILGUN_ENDPOINT="https://api.eu.mailgun.net/v3/m.website.com"
I didn't create an API key (well, I did - but it did nothing!). Instead I used the "HTTP webhook signing key" from 'Sending > Webhooks'.
Why? No idea. But it works.
(Things were a lot clearer using Postmark, but a lot cheaper using Mailgun)