2

I'm looking for a way to test some email-sending capability when developing an app locally, i.e on http://localhost:[some-port]

I'm using Mandrill by Mailchimp with it's official Mandrill API Module on Node.js.

Mandrill requires to set some DKIM/SPF settings for the sending domain and I'm not sure how to set my localhost as a Sending Domain.

From their docs:

You'll need to add SPF and DKIM records and verify ownership of your sending domains before you can send email through your account. Mandrill will not send any email from unverified domains or domains without valid SPF and DKIM records, including public domains like gmail.com, yahoo.com, and more.

So basically Mandrill requires setting the Sending Domains and the DKIM/SPF settings for each domain

I've successfully setup my main & live (www.something.com) domain's settings but now I want to also setup localhost so I can test when doing local development

Not setting localhost as a Sending Domain, caused "rejected/unsigned" errors

Of course if I don't set localhost as Sending Domain, any attempts to send a message results in this error:

[ { email: '[email protected]',
    status: 'rejected',
    _id: 'bdbd8317b1a14986852b93e12a24246e',
    reject_reason: 'unsigned' } ]

Setting localhost as a Sending Domain

Is there an actual way to set localhost as a Sending Domain?


Note: I am already testing with a Test API key

3
  • So there's no real way to do it locally without having a purchased .com domain, right? Sep 16, 2016 at 21:51
  • @blaughw Gotcha - Care to paste it as an answer? Sep 16, 2016 at 22:40
  • Damn I'm having the same problem. Nobody able to answer this?
    – Zach Cook
    Jan 11, 2018 at 21:44

1 Answer 1

2

DKIM/SPF Lookup

You should send emails as a valid domain in Public DNS. This allows DKIM and SPF lookups to function as intended. You can use the same domain as production/live, but you would probably want a subdomain like dev.something.com to be the sending domain. This would require it's own SPF/DKIM DNS entries.

Domain Ownership

Most recipient domains will not accept email from an unauthenticated/unvalidated source. So yes, you need to own a domain. it would be sufficient to get a free domain from EasyDNS, etc. You don't necessarily need a 2nd level domain. You do need the ability to add TXT records and CNAMEs on the zone for public lookup by receiving email servers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .