how to set up my own email domain

  1. get a domain mydomain.com

  2. get an smtp server to handle sending emails (link mydomain.com to smtp server)

  3. get a dns provider to register dns records, so that the domain will be able to receive emails

  4. (optional) ask dns provider to forward email sent to mydomain.com to a more easily accessible email service like gmail, to enable normal email workflow with gmail, such as UI; instead of using the smtp provider’s email UI; wait, i actually dont need that

  5. (optional) allow gmail to send mail as mydomain.com

wait, i actually don’t need step 4

  • step 4 is for when my domain isn’t linking to a smtp server, if i set up MX records in dns provider, dns provider will route (forward) emails sent to mydomain.com to another email:
    • sender sends email to [email protected] dns provider handles dns and forward to gmail
    • i actually don’t need this forwarding!

sending and receiving emails are two separate things!

sending:

  • SMTP is used, need an smtp server
  • need to set up dns record (SPF, DKIM, DMARC) in dns provider for the SMTP server to send with a custom domain
    • they are actually all TXT records.
    • these records are for authentication, they are used to prove that this SMTP server is allowed to use this domain

receiving:

  • set up MX records on DNS provider, so that incoming emails to this domain are directed to the correct SMTP server
    • in the case for ^step-4, i set up MX record to forward emails sent to my domain to my gmail
  • a mail server runs somewhere to receive the emails forwarded by DNS provider

questions i have when implementing

  • other than MX record, why do i still need other stuff in my dns config?
  • why would an email be marked as spam?
  • what’s DMARC
  • on resend, there’s no place to config my email prefix, it’s currently done on cloudflare (yc@, me@, etc), if i don’t add them to cloudflare, the email will get lost and won’t be received. why is that? i have no place to config this prefix on SMTP server, and have to config on cloudflare?
  • if i disable routing for yc@domain on cloudflare, it won’t be able to receive email.