mailgun icon indicating copy to clipboard operation
mailgun copied to clipboard

Clearer set-up documentation

Open mattias78 opened this issue 3 years ago • 6 comments

Description

With the set-up instructions it would be great if it could clearly communicate:

  1. which Mailgun API key to use (Private or Public)
  2. what (or how to access) the required 'Endpoint' - not obvious from the Mailgun dashboard?

mattias78 avatar Jul 21 '22 01:07 mattias78

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!

bymayo avatar Oct 19 '22 11:10 bymayo

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 avatar Oct 20 '22 02:10 mattias78

@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.

bymayo avatar Oct 20 '22 08:10 bymayo

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

damienbuckley avatar Feb 08 '23 03:02 damienbuckley

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.

icreatestuff avatar May 04 '23 10:05 icreatestuff

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)

iparr avatar Dec 08 '23 14:12 iparr