emailsmtpamazon-sesemail-clientsparkpost

How sparkpost edits email "to" and "cc" header?


In sparkpost, if I was to send emails to "person.1@email.com", "person.2@email.com" & "person.3@email.com" & along with that have cc'ed email "cc.person@email.com".

{
  "recipients": [
    {
      "address": {
        "email": "person.1@email.com"
      }
    },
    {
      "address": {
        "email": "person.2@email.com"
      }
    },
    {
      "address": {
        "email": "person.3@email.com"
      }
    },
    {
      "address": {
        "email": "cc.1@email.com",
        "header_to": "person.1@email.com;person.2@email.com;person.3@email.com"
      }
    }
  ],
  "content": {
    "from": "you@fromyou.com",
    "headers": {
      "CC": "cc.1@email.com"
    },
    "subject": "To and CC",
    "text": "This mail was sent to many while CCing cc.1@email.com."
  }
}

Here cc would only get 1 email, with all "to" addresses in email's to header. All other "to" emails would also get 1 email, where each recepient is only able to see 2 emails : his own & the cc email. My question is how do they do this? I have to replicate this to Amazon Ses raw email. I tried sending emails indiviually, but cc is getting n + 1 emails as there are n "to" & 1 of his own.

I tried to send email individually in Amazon ses raw email but cc gets n + 1 emails as he has been cc'ed in those n "to" emails.


Solution

  • The headers only matter for display purposes; what is actually being sent is determined by the SMTP envelope. There is no way to have individualized headers in each message other than by sending individualized messages. Probably behind the scenes, they split up the message into multiples after generating the Cc: copy.

    In some more detail,

    There are many questions about the difference between headers and envelope information. In very brief, SMTP lets you specify the sender with MAIL FROM:<me@example.org> and each recipient with RCPT TO:<victim@example.net>; and then, you supply the message in the DATA transaction, including all the headers. (The headers will be updated by reach handling MTA; on delivery, the final MTA will usually put the envelope sender in Return-Path:, and optionally the final local recipient in Delivered-To:.)