Search code examples
gmailmailgunspfdkimdmarc

Getting rid of 'via' in google mailing via Mailgun, DMARC, SPF and DKIM records


I am using mailgun under the domain 'mg.mydomain.org' but I want emails send to be authenticated to my domain, lets say its 'mydomain'.

The settings below dont seem to work at all and I am still seeing the 'via' in gmail. Ive looked over the gmail docs and not got any further.

I am not experienced in setting up this type of configuration so if any more information is required to help ill be happy to provide

Dmarc record is currently : 
"v=DMARC1; p=none; rua=mailto:[email protected]"

SPF record:
"v=spf1 include:mailgun.org ~all"

DKIM record is generated from the mail client
"k=xxx; p=xxxxxx"

Thanks,

M


Solution

  • Typically the "via" flag appears in gmail when the "From:" header in an email doesn't match the sending domain.

    If you're using the Mailgun API, check that you're using the right sending domain.

    Example:

    curl -s --user 'api:key-abcd1234' \
    https://api.mailgun.net/v3/mg.mydomain.org/messages \
    -F from='Me <[email protected]>' \
    -F to='[email protected]' \
    -F subject='Hello' \
    -F text='Testing'
    

    In the example, the from domain is just the mydomain.org. Gmail should still render it without the "via".