How to send email using your own domain

How to send email using your own domain

You may have noticed, that when using standard PHP mail send functions, you cannot use your own domain as the sender address.

The reason for this is, that Domain ownership / management is in no way tied to our system. Without a way to properly validate domain ownership internally, we cannot guarantee that a website would only be able to send mail via the allowed domains. Effectively, any website could claim to send mail via any domain, which is obviously no good.

Mailgun is a nifty little service to solve this issue. Here’s how to set it up:

  1. Install “Mailgun for WordPress” -plugin for your WordPress site. You can either search for it in WP Admin, or find it here:
  2. Create a free account at and choose to add your Credit Card. Without a Credit Card added, all recipient addresses have to be added in manually! You will not be billed for basic usage (10 000 emails per month).
  3. Add your domain using dashboard. Mailgun will then instruct you on how to validate your domain.
  4. After adding the domain, find the “API Key” Mailgun generated for your domain under “Domain Information”.
  5. Copy the “API Key” and add it to your “Mailgun for WordPress” -plugin settings.
  6. Also set “From Name”, “From Address” and “Mailgun Domain Name” at plugin settings.

And presto! Your outgoing email will now be sent through the domain you specified.