So You'd Like to Send Some Email (Through Code)
Created on 2020-10-03T23:40:23+00:00
- Sending e-mail is easy but making sure the recipient gets it is not.
Reverse DNS
- Make sure whoever issues your IP has their "reverse DNS" records correct.
- The article mentions "ISP," but this is also whoever you buy your virtual machine access from.
- This is also known as a "PTR" record.
SPF
- Mostly a microsoft/hotmail thing.
- Add a TXT record to your DNS which identifies servers allowed to claim they are delivering mail for you.
v=spf1 a mx ip4:10.0.0.1 ip4:10.0.0.2 ~all
- ip4:
DKIM
- DKIM signs messages with a secret key to prove it was started from an authorized server.
Generate them with OpenSSL:
$ openssl genrsa -out rsa.private 1024 $ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM
Add some more TXT records to your DNS:
_domainkey.example.com "o=~; r=contact@example.com" selector._domainkey.example.com "k=rsa; p={public-key-base64-string-here}"