0

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.

Community
  • 1
  • 1
shaharpan
  • 91
  • 8

1 Answers1

0

Unless you can point to something in the documentation, I don't believe Gmail API in any way honors the RCPT TO header. Try:

Bcc: <to@recipient.com>
To: <dummy@dummy.com>

This will send to BOTH addresses. Assuming dummy.com does exist and you don't want to send mail to it you'll need to use a direct SMTP connection to SMTP.gmail.com to keep rcpt to and to header entirely independent of each other.

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
  • I have noticed that recipient gets "mailed by:gmail.com" instead of normal "mailed by: yourdomain.com", there are few plugin like Mixmax which does this. – shaharpan Jul 22 '16 at 11:54