Sendgrid-csharp: Cannot set open tracking with new v3 api

Created on 13 Sep 2016  路  7Comments  路  Source: sendgrid/sendgrid-csharp

Issue Summary

Using mail helper I'm trying to send an email with open tracking enabled. This is the relevant code:

        message.TrackingSettings = new TrackingSettings()
        {
            ClickTracking = new ClickTracking()
            {
                Enable = true,
                EnableText = true
            },
            OpenTracking = new OpenTracking()
            {
                Enable = true
            },
            SubscriptionTracking = new SubscriptionTracking()
            {
                Enable = true,
                SubstitutionTag = "##VinculoAnularSuscripcion##"
            }
        };

But I'm not getting open tracking. I have also enabled Open Tracking in my SendGrid account.

Steps to Reproduce

  1. Create a mail with helper
  2. Set the tracking settings as above
  3. Send mail with: await client.client.mail.send.post(requestBody: message.Get());

Mail should have open tracking enabled.

Technical details:

  • sendgrid-csharp Version: 8.0.4
  • .NET Version: 4.5.2
help wanted question

All 7 comments

Hello @escobar5,

Could you please provide the output of message.Get()? Thanks!

Sure, here it is:

{"from":{"name":"David","email":"****@q*****es.com"},"subject":"Prueba API","personalizations":[{"to":[{"name":"q sendgrid","email":"*****@q******s.com"}],"substitutions":{"##Titulo##":"","##LogoInstitucional##":"","##NombreInstitucion##":"","##PaginaWebInstitucion##":"","##TelefonoInstitucion##":"","##DireccionInstitucion##":"","##ColorInstitucional##":"","##campaign_id##":"","##NombreCompleto##":"","##CorreoElectronico##":"","##transaction_id##":"","##AplentId##":"","##TPEmail##":"","##UnsuscribeCategory##":"","##baseUrl##":""}},{"to":[{"name":"Juan","email":"******@gmail.com"}],"substitutions":{"##Titulo##":"","##NombreInstitucion##":"INSTITUCI\u0026#211;N DEMOSTRACI\u0026#211;N - dbzq10trabajos","##PaginaWebInstitucion##":"www.q10soluciones.com","##TelefonoInstitucion##":"43242332","##DireccionInstitucion##":"fdsfdsfsd","##ColorInstitucional##":"#47a447","##campaign_id##":"3045","##NombreCompleto##":"Juan","##CorreoElectronico##":"******@gmail.com","##transaction_id##":"12223","##AplentId##":"d0af2edd-d0fb-482d-82cf-88a9b6b0610e","##TPEmail##":"anNlc2NvYmFyNUBnbWFpbC5jb20%3d-SISQc4AtrmE%3d","##UnsuscribeCategory##":"1","##baseUrl##":"http://localhost:1620"}}],"content":[{"type":"text/html","value":"\u003c!DOCTYPE HTML PUBLIC \u0022-//W3C//DTD XHTML 1.0 Transitional//EN\u0022 \u0022http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\u0022\u003e\r\n\u003chtml\u003e\r\n\u003chead\u003e\r\n \u003cmeta http-equiv=\u0022Content-Type\u0022 content=\u0022text/html; charset=UTF-8\u0022 /\u003e\r\n \u003ctitle\u003e\u003c/title\u003e\r\n \u003cstyle type=\u0022text/css\u0022\u003e\r\n #outlook a {\r\n padding: 0;\r\n }\r\n .ReadMsgBody {\r\n width: 100%;\r\n }\r\n\r\n .ExternalClass {\r\n width: 100%;\r\n }\r\n img {\r\n border: 0;\r\n height: auto;\r\n line-height: 100%;\r\n outline: none;\r\n text-decoration: none;\r\n }\r\n\r\n table td {\r\n border-collapse: collapse;\r\n }\r\n\r\n h1, .h1 {\r\n color: #202020;\r\n display: block;\r\n font-family: Arial;\r\n font-size: 34px;\r\n font-weight: bold;\r\n line-height: 100%;\r\n margin-top: 0;\r\n margin-right: 0;\r\n margin-bottom: 10px;\r\n margin-left: 0;\r\n text-align: left;\r\n }\r\n\r\n h2, .h2 {\r\n color: #202020;\r\n display: block;\r\n font-family: Arial;\r\n font-size: 30px;\r\n font-weight: bold;\r\n line-height: 100%;\r\n margin-top: 0;\r\n margin-right: 0;\r\n margin-bottom: 10px;\r\n margin-left: 0;\r\n text-align: left;\r\n }\r\n\r\n h3, .h3 {\r\n color: #202020;\r\n display: block;\r\n font-family: Arial;\r\n font-size: 26px;\r\n font-weight: bold;\r\n line-height: 100%;\r\n margin-top: 0;\r\n margin-right: 0;\r\n margin-bottom: 10px;\r\n margin-left: 0;\r\n text-align: left;\r\n }\r\n\r\n h4, .h4 {\r\n color: #202020;\r\n display: block;\r\n font-family: Arial;\r\n font-size: 22px;\r\n font-weight: bold;\r\n line-height: 100%;\r\n margin-top: 0;\r\n margin-right: 0;\r\n margin-bottom: 10px;\r\n margin-left: 0;\r\n text-align: left;\r\n }\r\n\r\n .preheaderContent div {\r\n color: #505050;\r\n font-family: Arial;\r\n font-size: 12px; /*10px*/\r\n line-height: 100%;\r\n text-align: left;\r\n }\r\n\r\n .preheaderContent div a:link, .preheaderContent div a:visited, /* Yahoo! Mail Override */ .preheaderContent div a .yshortcuts /* Yahoo! Mail Override */ {\r\n color: #336699;\r\n font-weight: normal;\r\n text-decoration: underline;\r\n }\r\n\r\n .headerContent {\r\n color: #202020;\r\n font-family: Arial;\r\n font-size: 34px;\r\n font-weight: bold;\r\n line-height: 100%;\r\n padding: 0;\r\n text-align: center;\r\n vertical-align: middle;\r\n }\r\n\r\n .headerContent a:link, .headerContent a:visited, /* Yahoo! Mail Override */ .headerContent a .yshortcuts /* Yahoo! Mail Override */ {\r\n color: #336699;\r\n font-weight: normal;\r\n text-decoration: underline;\r\n }\r\n\r\n #headerImage {\r\n height: auto;\r\n max-width: 600px !important;\r\n }\r\n\r\n .bodyContent div {\r\n color: #505050;\r\n font-family: Arial;\r\n font-size: 14px;\r\n line-height: 150%;\r\n text-align: left;\r\n }\r\n\r\n .bodyContent div a:link, .bodyContent div a:visited, /* Yahoo! Mail Override */ .bodyContent div a .yshortcuts /* Yahoo! Mail Override */ {\r\n color: #336699;\r\n font-weight: normal;\r\n text-decoration: underline;\r\n }\r\n\r\n .bodyContent img {\r\n display: inline;\r\n height: auto;\r\n }\r\n\r\n .footerContent div {\r\n /*color: #707070;*/\r\n font-family: Arial;\r\n font-size: 12px;\r\n line-height: 125%;\r\n text-align: left;\r\n }\r\n\r\n .footerContent div a:link, .footerContent div a:visited, /* Yahoo! Mail Override */ .footerContent div a .yshortcuts /* Yahoo! Mail Override */ {\r\n color: #336699;\r\n font-weight: normal;\r\n text-decoration: underline;\r\n }\r\n\r\n .footerContent img {\r\n display: inline;\r\n }\r\n\r\n #monkeyRewards img {\r\n max-width: 190px;\r\n }\r\n \u003c/style\u003e\r\n\u003c/head\u003e\r\n\u003cbody leftmargin=\u00220\u0022 marginwidth=\u00220\u0022 topmargin=\u00220\u0022 marginheight=\u00220\u0022 offset=\u00220\u0022 style=\u0022-webkit-text-size-adjust: none;margin: 0;padding: 0;background-color: #FAFAFA;width: 100% !important;\u0022\u003e\r\n \u003ccenter\u003e\r\n \t\u003ctable border=\u00220\u0022 cellpadding=\u00220\u0022 cellspacing=\u00220\u0022 height=\u0022100%\u0022 width=\u0022100%\u0022 id=\u0022backgroundTable\u0022 style=\u0022height:100% !important;margin: 0;padding: 0;width: 100% !important;background-color: #FAFAFA;\u0022\u003e\r\n \t\u003ctbody\u003e\u003ctr\u003e\r\n \t\u003ctd align=\u0022center\u0022 valign=\u0022top\u0022\u003e\r\n \t\u003ctable border=\u00220\u0022 cellpadding=\u00220\u0022 cellspacing=\u00220\u0022 width=\u0022600\u0022 id=\u0022templateContainer\u0022 style=\u0022margin-top:20px;border: 1px solid #DDDDDD;background-color: #FFFFFF;\u0022\u003e\r\n \t\u003ctbody\u003e\r\n \u003ctr id=\u0022linkweb\u0022\u003e\r\n \u003ctd align=\u0022center\u0022 valign=\u0022top\u0022 class=\u0022footerContent\u0022 style=\u0022border-collapse: collapse;\u0022\u003e\r\n \u003cdiv style=\u0022text-align: center; color: #707070; font-family: Arial; font-size: 12px; line-height: 125%;\u0022 align=\u0022center\u0022\u003e\r\n Si no puede ver correctamente este correo haga \u003ca data-href=\u0022##baseUrl##/campania/##campaign_id##/ver?aplentId=##AplentId##\u0026amp;tid=##transaction_id##\u0022 href=\u0022##baseUrl##/campania/##campaign_id##/ver?aplentId=##AplentId##\u0026amp;tid=##transaction_id##\u0022 style=\u0022color: #336699; font-weight: normal; text-decoration: underline;\u0022\u003eclic aqu铆\u003c/a\u003e.\r\n \u003c/div\u003e\r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \t\u003ctr\u003e\r\n \t\u003ctd align=\u0022center\u0022 valign=\u0022top\u0022\u003e\r\n \u003c!-- // Begin Template Body \\\\ --\u003e\r\n \t\u003ctable border=\u00220\u0022 cellpadding=\u00220\u0022 cellspacing=\u00220\u0022 width=\u0022600\u0022 id=\u0022templateBody\u0022\u003e\r\n \t\u003ctbody\u003e\u003ctr\u003e\r\n \u003ctd valign=\u0022top\u0022 class=\u0022bodyContent\u0022 style=\u0022background-color: #FFFFFF;\u0022\u003e\r\n \r\n \u003c!-- // Begin Module: Standard Content \\\\ --\u003e\r\n \u003ctable border=\u00220\u0022 cellpadding=\u002220\u0022 cellspacing=\u00220\u0022 width=\u0022100%\u0022\u003e\r\n \u003ctbody\u003e\u003ctr\u003e\r\n \u003ctd valign=\u0022top\u0022\u003e\r\n \u003cdiv class=\u0022cke_focus\u0022 style=\u0022position: relative;\u0022\u003e\u003ch1 class=\u0022h1\u0022\u003eT铆tulo\u003c/h1\u003e\r\n\r\n\u003cp\u003e\u003cstrong\u003ePersonalice esta plantilla:\u003c/strong\u003e para personalizar esta plantilla de clic sobre el elemento que desea modificar y realice los cambios deseados.\u003c/p\u003e\r\n\r\n\u003cp\u003ePuede ingresar nuevos elementos, modificar o borrar los existentes.\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\u0026nbsp;\u003c/p\u003e\r\n\u003c/div\u003e\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003c!-- // End Module: Standard Content \\\\ --\u003e\r\n \r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003c!-- // End Template Body \\\\ --\u003e\r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \t\u003ctr\u003e\r\n \t\u003ctd align=\u0022center\u0022 valign=\u0022top\u0022\u003e\r\n \u003c!-- // Begin Template Footer \\\\ --\u003e\r\n \t\u003ctable border=\u00220\u0022 cellpadding=\u002210\u0022 cellspacing=\u00220\u0022 width=\u0022600\u0022 id=\u0022templateFooter\u0022 style=\u0022background-color: #FFFFFF; border-top: 0;\u0022\u003e\r\n \t\u003ctbody\u003e\u003ctr\u003e\r\n \t\u003ctd valign=\u0022top\u0022 class=\u0022footerContent\u0022\u003e\r\n \r\n \u003c!-- // Begin Module: Standard Footer \\\\ --\u003e\r\n \u003ctable border=\u00220\u0022 cellpadding=\u002210\u0022 cellspacing=\u00220\u0022 width=\u0022100%\u0022\u003e\r\n \u003ctbody\u003e\r\n \u003ctr\u003e\r\n \u003ctd colspan=\u00222\u0022 valign=\u0022middle\u0022 id=\u0022utility\u0022 style=\u0022background-color: #FFFFFF; border: 0;\u0022\u003e\r\n \u003cdiv style=\u0022text-align: center; position: relative;\u0022\u003e\u003cp\u003eSi no deseas continuar recibiendo esta informaci贸n, haz \u003ca data-href=\u0022##baseUrl##/suscripciones/remover?aplentId=##AplentId##\u0026amp;uid=##TPEmail##\u0026amp;cid=##UnsuscribeCategory##\u0022 href=\u0022##baseUrl##/suscripciones/remover?aplentId=##AplentId##\u0026amp;uid=##TPEmail##\u0026amp;cid=##UnsuscribeCategory##\u0022\u003eclic aqu铆\u003c/a\u003e para cancelar tu suscripci贸n.\u003c/p\u003e\r\n\u003c/div\u003e\r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003c!-- // End Module: Standard Footer \\\\ --\u003e\r\n \r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003c!-- // End Template Footer \\\\ --\u003e\r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003cbr\u003e\r\n \u003c/td\u003e\r\n \u003c/tr\u003e\r\n \u003c/tbody\u003e\u003c/table\u003e\r\n \u003c/center\u003e\r\n\u003c/body\u003e\r\n\u003c/html\u003e"}],"custom_args":{"transaction_id":"##transaction_id##","aplent_id":"d0af2edd-d0fb-482d-82cf-88a9b6b0610e","campaign_id":"3045"},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true},"subscription_tracking":{"enable":true,"substitution_tag":"##VinculoAnularSuscripcion##"}}}

Everything looks good. What specifically did you check to determine that open tracking was not enabled?

Do you mind sending me an email to [email protected] so I can open it and check the raw email?

I checked the sendgrid console, there's no open activity.

Sure, give me a second, I'll send one test to you.

Hello @escobar5,

Thanks, I received the test.

I don't see what the issue might be, so I suggest you submit a ticket with https://support.sendgrid.com so that we can dig deeper with you.

With Best Regards,

Elmer

HI @thinkingserious

Thanks for your help, the strange thing is that I can see your opens, but I cannot se the ones from my email. What can that be? gmail?

I've just found the problem, it was my ad blocker.

Thanks for your time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ivivanov picture ivivanov  路  3Comments

fireole picture fireole  路  4Comments

thinkingserious picture thinkingserious  路  4Comments

clairernovotny picture clairernovotny  路  4Comments

eat-sleep-code picture eat-sleep-code  路  3Comments