Mailgun Namecheap Laravel
2021-09-01 | 1 min reading
Some notes on how to setup Mailgun with Laravel 8 and Namecheap.
Assuming you want to do the setup for acme.com
Mailgun
Add domain:
https://app.mailgun.com/app/sending/domains
Api Keys:
https://app.mailgun.com/app/account/security/api_keys
Copy Private API key
for MAILGUN_SECRET
.
Namecheap
# Host Records
Type | Host | Value | TTL
-------------------------------------------------------------------------------
CNAME Record | email.mg | mailgun.org. | Automatic
TXT Record | mg | v=spf1 include:mailgun.org ~all | Automatic
TXT Record | mx._domainkey.mg | k=rsa; p=xxxxxxxxxxxxxxxxxxxxx | Automatic
# Mail settings : Custom MX
Type | Host | Value (Mailserver) | Priority | TTL
-------------------------------------------------------------------------------
MX Record | mg | mxa.mailgun.org. | 10 | Automatic
MX Record | mg | mxb.mailgun.org. | 10 | Automatic
Laravel Configuration
# within .env
MAIL_MAILER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=hello@acme.com
MAIL_FROM_NAME="${APP_NAME}"
MAILGUN_DOMAIN=mg.acme.com
MAILGUN_SECRET=2xxxxxxxxxxxxxxxxxx-xxxxxx-xxxxx