stack twitter rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Receiving email via SendGrid and Namecheap

    If you have a domain with Namecheap and want to relay messages received on that domain to SendGrid so you can then process them as objects (for example via Griddler in a Rails app), read on.

    SendGrid

    We'll whitelabel your domain, then we'll return to set up an inbound parse.

    Whitelabel

    1. Log in to your SendGrid account (or sign up, if you don't have one)
    2. Go to Settings
    3. Go to Whitelabels
    4. Click Add Domain
    5. Choose a subdomain, e.g. email
    6. Enter your domain, e.g. examplesite.com (no protocol)
    7. Allow Automated Security
    8. Click Save

    This will need to be validated, after we've configured Namecheap and the DNS updates have propagated.

    Namecheap

    First, go to your advanced DNS settings. Steps below if needed.

    1. Log in to your Namecheap account
    2. Click Account
    3. Click Dashboard
    4. Select Manage for the domain you want to use
    5. Click Advanced DNS

    You may already have some host records, for example a CNAME record for www and a URL Redirect Record for @. Either way, we can add some additional ones without conflict. Add the following records, replacing the X and # characters with your own details from SendGrid.

    Type Host Value TTL
    CNAME Record email. X#######.XX###.sendgrid.net. Automatic
    CNAME Record s1._domainkey s1.domainkey.X#######.XX###.sendgrid.net. Automatic
    CNAME Record s2._domainkey s2.domainkey.X#######.XX###.sendgrid.net. Automatic

    The full stop placement is essential.

    Now we need to set an MX Record. Under Mail Settings select Custom MX and add the following record.

    Type Host Mail Server Priority TTL
    MX Record @ mx.sendgrid.net. 10 Automatic

    Note that here I'm relaying all email to SendGrid. This is not necessarily what you want to do.

    Once you've added these records, it can take up to 48 hours for the changes to propagate. In my case it took about 2 minutes. For a quick check on whether you're there or not, you can use MxToolbox's MX Lookup.

    Inbound Parse

    Back in the SendGrid settings, make sure you validate the Whitelabel settings. If you don't get a nice green checkmark, either the settings in Namecheap and SendGrid are incorrect or you need to be patient for the DNS changes to propagate.

    Once validated:

    1. Go to Settings
    2. Go to Inbound Parse
    3. Click Add Host & URL*
    4. Leave the subdomain empty
    5. For domain, select your whitelabelled domain
    6. As destination URL, choose the URL on your domain which is going to handle incoming emails, e.g. http://www.examplesite.com/email_processor

    Now repeat these steps again, but with www for the subdomain.

    Once done, you can test everything is working by sending an email to your domain. In SendGrid, this should then show up in the Activity Feed (Activity menu item).