Hola!
I just finished some email tracking software, and I’m going to explain very quickly how it works.
My newsletter sender appends a specific image to the end of the email, with a specific get request that identifies the recipient.
Lets say I have a subscriber model, full of emails. I send the email: “Hello”
subscriber = Subscriber(email='yuji@anuvawines.com', name='Yuji Tomita') subject = 'testing open tracking' body = "hello' new_body = body + '<img src="/open-tracking/?id=%s" />' % (subscriber.id) send_html_mail(subject, new_body, "from@anuvawines.com", [subscriber.email])
This sends an email with an image embedded that identifies the subscriber.
Now, for the view to handle the image request. It must return a valid image or else your html email will often have a broken image icon. Here’s how to pass back an image in django:
def track-open-emails(request): if 'id' in request.GET: #do something with the id, which tells you that specific subscriber has opened the email. #do something to record that an email has been opened. image_data = open("/path_to_image/", 'rb').read() return http.HttpResponse(image_data, mimetype="image/png")
done!
I request somebody to sponse on my university studies
Nifty! Thanks for sharing. I was curious how people did that and didn’t realize it would be so simple.
Hy Yuri!
I know it’s an old post, but i hope you will answer my post.
1st of all thanx for the method, i’ll try it soon.
But there is a question which does not leave my head to rest:
what if the reciver mail client (outlook etc.) disable any img default.
Is this method tracking when the images are disabled in a client?
Thanks for your answer.
best regards
Sumia01
Hey there,
Sorry but I’m not familiar with other ways of tracking email opens – they would be a combination of the image technique and other methods listed in the wiki page.
I would ask stackoverflow.com or google more ; )
Good luck!
Hi all, default,the Email doesn’t allow to auto the image , so we can not tracking .
If you have another solution , please help me to share it.
Thanks.
Hey Yuji,
I am trying to implement the same in my code, but struggling to implement because i am very new to python and Django. Will be very helpful if you can share the complete code to me.
Hey Yuji,
I am trying to implements the same but my request is not rendering from mail server to localhost. I used hashed id with image. but not able to understand logic behind urls.py please help