Mailgun SPF, DKIM, and DMARC Setup Instructions
Logtrade uses the Mailgun service provider to deliver advice emails on behalf of our customer.
If you want to change the sender address to use your own domain name you need to
take some steps to ensure your emails are delivered properly and not flagged as spam.
Specifically, you need to configure SPF, DKIM, and DMARC in your domain's DNS settings.
Configure SPF Record
SPF (Sender Policy Framework) helps prevent email spoofing by specifying which mail servers are allowed to send emails on behalf of your domain.
Steps to Add SPF Record
In your DNS settings, look for an existing SPF record (TXT record with v=spf1). If one already exists, modify it to include Mailgun.
If there is no existing SPF record, add a new TXT record with the following details:
- Type:
TXT - Name (Host):
@(or your domain name if required) - Value
v=spf1 include:mailgun.org ~all - TTL:
3600(or leave default)
Note: If you already have an SPF record, merge it with the existing one instead of creating a new one. Example:
v=spf1 include:existing-provider.com include:mailgun.org ~all
Configure DKIM Record
DKIM (DomainKeys Identified Mail) helps verify that emails sent from your domain are authentic.
Steps to Add DKIM Record
In your DNS settings, add a new TXT record:
- Type:
TXT - Name (Host):
s1._domainkey - Value:
k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCkdsohM62at1qa5f8XVvlL6Hc9gbJzPIfiWjj7VwDnIXYDJQK9qyK4RiS3XysiiFQfBWNDWgQi52m+5aPNVA7f1bWtxW64tg1JirYwRaDNWlMccYkBvEQGKZoMKn3q6UOgRdqqKkIuihoMh6ygVzCw+gWIDTrBNwVhkphMMCUokQIDAQAB - TTL:
3600(or leave default)
Configure DMARC Record
DMARC (Domain-based Message Authentication, Reporting, and Conformance) ensures that SPF and DKIM are enforced and provides reporting on email activity.
In your DNS settings, add a new TXT record:
- Type:
TXT - Name (Host):
_dmarc - Value:
v=DMARC1; p=none; rua=mailto:your-report-email@example.com; ruf=mailto:your-report-email@example.com; pct=100; - TTL:
3600(or leave default)
Replace your-report-email@example.com with an actual email address where you want to receive DMARC reports.
The p=none policy is a starting point. You can change it to p=quarantine or p=reject once you're confident that email authentication is working correctly.
Verify Your Setup
After adding the records, you can use online tools to verify a correct setup.
Use online tools like:
Once verified, Mailgun will authenticate your emails, improving deliverability and security.