title: How does the "Send Mail As" feature work (at a technical level) in Gmail?
body: <p>I don't have any technical problems, but I have a question that I would like to be answered out of curiosity.</p>
  <p>Here is my current understanding of how email works:</p>
  <p>One of the privileges of having your own domain is that you can hook it up to IMAP/POP3/SMTP servers and use them to send and receive messages to and from &quot;anyone@yourdomain.com&quot;. With spam being such a problem, however, the SMTP server that you use to send messages must add a bunch of headers (DKIM, SPF, etc) to each message that you send in order to prove that the SMTP server has the authority to send emails from that domain. The receiving SMTP server can cross-check those headers with DNS records that it finds to verify the legitimacy of the email message.</p>
  <p>So if you want to send emails with your domain cheaply, you can use Gmail's &quot;Send Mail As&quot; feature. I followed this help article to get mine working: <a href="https://support.google.com/domains/answer/9437157" rel="nofollow noreferrer">https://support.google.com/domains/answer/9437157</a></p>
  <p><em>Note: I unchecked the &quot;Treat as an alias&quot; option during the setup.</em></p>
  <p>But wait... no additional DNS configuration required? I have my domain registered with Cloudflare, and there are no entries related to Google in there.</p>
  <p>There is this step in the setup process:
  <a href="https://i.stack.imgur.com/7d5aI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7d5aI.png" alt="verify email address screen" /></a></p>
  <p>But it seems that this only for Google to prevent <em>you</em> from using <em>their</em> servers to send spam. <strong>What is stopping Google from impersonating any email address they want? Why do receiving SMTP servers trust an email from &quot;anyone@yourdomain.com&quot; if Google's SMTP servers have no way of adding legitimate SPF/DKIM headers?</strong></p>