anymail / django-anymail

Django email backends and webhooks for Amazon SES, Brevo (Sendinblue), MailerSend, Mailgun, Mailjet, Postmark, Postal, Resend, SendGrid, SparkPost, Unisender Go and more
https://anymail.dev
BSD 3-Clause "New" or "Revised" License
1.65k stars 125 forks source link

Mailjet Open tracking? #342

Closed torusservices closed 10 months ago

torusservices commented 10 months ago

I do not see any open tracking specifically with Mailjet, on Sendinblue it works by default. But Mailjet not even on their side there doesn't seem to be any open tracking. Even tho it is enabled on the fresh account.


from django.core.mail import send_mail, get_connection
from django.http import HttpResponse

def send_email_view(request):

#     You can even use multiple Anymail backends in the same app:
    mailjet_backend = get_connection('anymail.backends.mailjet.EmailBackend',)
    send_mail("",
            "",
            "",
            [""],
            connection=mailjet_backend)

    return HttpResponse("Email sent successfully!") 
torusservices commented 10 months ago

mind you delivered tracking is working

medmunds commented 10 months ago

Open tracking works by adding an invisible <img> tracking pixel to the html part of the email. If your email only includes plain text, not html, the behavior depends on your ESP. Some ESPs (like Sendinblue apparently) will convert your plain text to html, and include the tracking pixel in that. Other ESPs (like Mailjet) send a text-only message, which won't have a tracking pixel so won't generate open events.

If you want to use open or click tracking, it's best to send email that includes both html and text parts:

send_mail(
    "subject", 
    "text message", 
    "from@example.com", 
    ["to@example.com"], 
    html_message="html message"  # <--
)
medmunds commented 10 months ago

@torusservices if that didn't solve your problem, please reopen with additional details to reproduce

torusservices commented 10 months ago

No you clarified it perfectly sorry about forgetting to reply that you helped!