-2

I have a question about tracking email. I've made a server that tracks an email by the inserting the target URL into <img>.

Until now all is good, but if the user (the sender) opens the email, the server gets a GET Request from the Google image proxy. Now this is bad, because this tracking URL was targeting the recipients and not the sender.

I've thought of changing the URL in the sender's side like MailTrack.io does, but don't know how.

E_net4
  • 27,810
  • 13
  • 101
  • 139
Jwan
  • 177
  • 3
  • 12
  • When you send an email (on most servers) you prepare two copies of the email: one you send by SMTP for the recipient. The other you append via IMAP to the Sent mailbox for the sender. These are usually the same, but they do not have to be. – Max Feb 06 '22 at 19:45
  • 1
    Note that some servers, notably, Gmail, will automatically generated the sent mailbox copy from the SMTP transaction, to save time/bandwidth. You could theoretically find and delete that. – Max Feb 06 '22 at 19:46
  • Hi @Max, that is an interesting concept. After some research in Google API docs, I found something fascinating. In [Gmail API](https://developers.google.com/identity/protocols/oauth2/scopes#gmail) section, the `https://www.googleapis.com/auth/gmail.modify`. I wonder if that edits the saved copy on the user side. – Jwan Feb 07 '22 at 18:38
  • I might have found something about inserting an email without sending it. [Insert](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/insert). So as you, @Max, have suggested finding the email and delete it and with the `insert` method to create a fake copy of it. I don't know if that work's – Jwan Feb 07 '22 at 18:52
  • It can be done, but details vary with the code you use to (try), so I marked this as needing debugging details. – arnt Feb 10 '22 at 10:17
  • I'm a bit confused. Presumably you are sending lots of emails, and the tracking URL is different for each person. So, when the sender opens one, would they open one sent to themselves, rather than a recipient? Or is that still problematic for you? – Nathan Feb 14 '22 at 00:29
  • @Nathan just answer the question (anything), just to get the 50 Reps, before they expire – Jwan Feb 14 '22 at 21:44
  • @Nathan The problem basically is: The user A email user B. User B open the email, the embedded `` will make a request to google image proxy to retrieve the image from my server. That's all good and cool, but when user A also opens the email, the `` will also send a request. Now that's not cool. We do not want that. – Jwan Feb 14 '22 at 21:47
  • @Nathan `Mailtrack.io` uses a trick, where the email stored by User A is modified. – Jwan Feb 14 '22 at 21:49
  • Now I want to know how they did it. – Jwan Feb 14 '22 at 21:51
  • Oh like if User A opens it in their sent box? I gather that would be a backend question, based on how you are creating the email. I'm an email coder so can't help you with that. However, looks like people have given you a -1 for not posting your code thus far. It's hard to help without much of a starting point. – Nathan Feb 15 '22 at 05:03
  • I believe your down votes are because your grammar is making the question very difficult to understand. You might consider using a site like grammarly or grammar coach to clean up things like this before posting. – acolchagoff Feb 15 '22 at 16:04
  • @denodster the thing is, that this is kind of hard to explain. This is a bit complicated and true I've some grammar errors. The thing is, I already use a tool to help me with the grammar. :/ – Jwan Feb 15 '22 at 21:26

1 Answers1

0

Use a mail client that doesn't preview the image. I believe what is happening is that your current mail client is previewing the email for you and tripping your tracking link. Another option would be to use a service like Mailchimp, which will add the tracking code for you. I also believe certain versions of outlook have this feature but I'm not sure how much mileage that will get you.

acolchagoff
  • 1,926
  • 3
  • 18
  • 30