python - Pixel Tracking for a django based email -


i wanted know, of emails, have sent have opened email.

here how approach solve problem -

  1. create image file in html template should rendered.

    < img src="{{ tracking_url }}" height="1" width="1">

  2. once email opened request made url, have base64 encoded url pattern:

    base64_pattern = r'([a-za-z0-9+/]{4})*([a-za-z0-9+/]{2}==|[a-za-z0-9+/]{3}=)'

    url(r'^tracking/(?p{})/$'.format(base64_pattern), 'tracking_image_url', name='tracking_image_url'),

  3. that url serve image, , update counter, follows -

    transparent_1_pixel_gif = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b"

view -

def tracking_image_url(request, mail_64=none):     eml = base64.b64decode(mail_64)     // update counters in db table email address.      return httpresponse(transparent_1_pixel_gif, content_type='image/gif') 

i this, can't track opens, missing?


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -