I am trying to set dummy headers using gmail API. As per this thread (Correct email headers for delivering mailing list mail) RCPT TO and To headers are quite different. And If RCPT TO header is set TO header should only be used for showing to user and not actual sending. But when I am setting this to headers Gmail sends email to "TO" header and not RCPT TO.
this is what I am trying:
RCPT TO: actual_to <to@recipient.com>
From: Sender <sender@sender.com>
To: Dummy_to <dummy@dummy.com>
Subject: Saying Hello
This is a message just to say hello. So, "Hello".
encoding this and sending via gmail api.
POST https://www.googleapis.com/gmail/v1/users/arpan%40intricare.net/messages/send?fields=raw&key={YOUR_API_KEY}
{
"raw": "UkNQVCBUTzogYWN0dWFsX3RvIDx0b0ByZWNpcGllbnQClRsuY29tPgpGcm9tOiBTZW5kZXIgPHNl
bmRlckBzZW5kZXIuY29tPiAKVG86IER1bW15X3RvIDxkdW1teUBkdW1teS5jb20-IApTdWJqZWN0
OiBTYXlpbmcgSGVsbG8gCiAgICAKVGhpcyBpcyBhIG1lc3NhZ2UganVzdCB0byBzYXkgaGVsbG8u
IFNvLCAiSGVsbG8iLg=="
}
Google groups uses same concept to send emails to list of people an still use the to field as list name.