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
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.