Search code examples
gmailgmail-api

ONE Gmail email is sent and TWO different signatures are added


Gmail user [email protected] sends ONE email to TWO people.

Example:

FROM: [email protected]
TO: [email protected], sophie@example 

Gmelious plugin is able to place TWO DIFFERENT TRACKING HTML CODES in one, sent email, e.g.

bill - email no code (in bill's Gmail account)
alex - email with code1 (in alex's Gmail account)
sophie - email with code2 (in sophie's Gmail account)

How on earth Gmelious is doing this per-recipient tracking in their business plan?


Solution

  • There is no magic here. When you enable per-recipient tracking, two different mail messages are actually sent.

    You could verify it by clicking down arrow near reply button in Gmail and selecting "Show original":

    enter image description here

    If you compare raw messages received by [email protected] and [email protected], you will see that they differ:

    enter image description here

    In both messages you will see however the same header:

    To: [email protected], [email protected]

    But it shouldn't embarrass you. It's just SMTP header with text value. You could actually deliver message to one recipient and fill To header with any other e-mail.

    Tracking codes that Gmelius puts to message body also differ that allows to achieve per-recipient tracking.

    UPDATE

    You may be interested how Gmelius plugin is implemented, so that two different mail messages are sent when you actually compose one e-mail. It does it by using rich Gmail Add-ons API. To be more specific, sendEmail method of GmailApp class is used. If you check description of method parameters, you will see that it's possible to provide any subject, body, recipient list and other SMTP headers.

    But even with Gmelius plugin, the e-mails are delivered with gmail SMTP servers eventually. Gmelius just transforms original composed e-mail into multiple mail messages with different tracking codes.

    UPDATE (regarding security concerns)

    Gmail Add-ons API does not allow to send e-mails via 3rd party SMTP servers. sendEmail method does not have any parameter where you could specify another server. The e-mail is sent in the same way as if you send it from Gmail without Gmelius. Gmelius just splits recipients list and extend body with html tracking codes.

    If you still have any doubts regarding origin of e-mail, you could examine raw mail message. There you will see the actual server from which the message came:

    enter image description here

    This Received header basically says: mx.google.com server has received the mail from mail-sor-f65.google.com.